Does PyPy work with NLTK, and if so, is there an appreciable performance improvement, say for the bayesian classifier?
While we're at it, do any of the other python environments (shedskin, etc) offer better nlkt performance than cpython?
Compatibility: PyPy is highly compatible with existing python code. It supports cffi, cppyy, and can run popular python libraries like twisted, and django. It can also run NumPy, Scikit-learn and more via a c-extension compatibility layer.
It Doesn't Work Well With C Extensions PyPy works best with pure Python applications. Whenever you use a C extension module, it runs much slower than in CPython. The reason is that PyPy can't optimize C extension modules since they're not fully supported.
TL;DR version: you should use numpy. You can install it by doing pypy -m pip install numpy . You might also be interested in using the experimental PyPy binary wheels to save compilation time. The upstream numpy is written in C, and runs under the cpyext compatibility layer.
For Python 2.7, it's just called pypy . For CPython, if you would like to run Python 3 from the terminal, you simply enter the command python3 . To run PyPy, simply issue the command pypy3 . Entering the pypy3 command in the terminal might return the Command 'pypy3' not found message, as shown in the next figure.
At least some of NLTK does work with PyPy and there is some performance gain, according to someone on #pypy on freenode. Have you run any tests? Just download PyPy from pypy.org/download.html and instead of "time python yourscript.py data.txt" type "time pypy yourscript.py data.txt".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With