Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Besides Pyrex/Cython, already mentioned, you have other alternatives:</p> <p><a href="http://code.google.com/p/shedskin/" rel="nofollow">Shed Skin</a>: Translates (a restricted subset of) Python to C++. Can automatically generate an extension for you. You'd create an extension doing this (assuming Linux):</p> <pre><code>wget http://shedskin.googlecode.com/files/shedskin-0.7.tgz tar -xzf shedskin-0.7.tgz # On your code folder: PYTHONPATH=/path/to/shedskin-0.7 python shedskin -e yourmodule.py # The above generates a Makefile and a yourmodule.h/.cpp pair make # Now you can "import yourmodule" from Python and check it's from the .so by "print yourmodule.__file__ </code></pre> <p><a href="http://pypy.org/" rel="nofollow">PyPy</a>: A faster Python, with a JIT compiler. You could simply run your code on it instead of CPython. Only supports Python 2.5 now, 2.7 support soon. Can give huge speedups on math-heavy code. To install and run it (assuming Linux 32-bit):</p> <pre><code>wget http://pypy.org/download/pypy-1.4.1-linux.tar.bz2 tar -xjf pypy-1.4.1-linux.tar.bz2 sudo ln -s /path/to/pypy-1.4.1-linux/bin/pypy /usr/local/bin # Then, instead of "python yourprogram.py" you'll just run "pypy yourprogram.py" </code></pre> <p><a href="http://www.scipy.org/Weave" rel="nofollow">Weave</a>: Allows you to <a href="http://dpinte.wordpress.com/2010/04/22/interfacing-gsl-with-python-using-cython-comparison-with-weave/" rel="nofollow">write C inline</a>, the compiles it.</p> <p>Edit: If you want us to run these tools for you and benchmark, just post your code ;)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload