What is PyPy ?
- PyPy is an implementation of Python in Python which uses JIT(Just In Time) translation.
Why to Use PyPy?
- According to benchmarks “It depends greatly on the type of task being performed. The geometric average of all benchmarks is 0.18 or 5.6 times faster than CPython”.
Experience?
I have used PyPy for sandboxing for my project pylive, tested flask with pypy, ported brubeck to work on pypy, tested lastuser in PyPy 2.0beta1. In the experiment pypy-sandbox, requests, flask, werkzeug, jinja2, SQLAlchemy(postgres + sqlite), cython, greenlet, eventlet, markdown, gunicorn, dictshield, json, zmq
was tested.
If the library depends on C extensions more likely it needs rewrite using cffi. Here is the bummer, so you can’t use your requirements.txt
to directly deploy with PyPy
. For an example: pyzmq
library is written in C. So you can’t run in PyPy, so one needs to use zmqpy, pyzmq.
Benchmarks
Benchmark of brubeck
after porting shows PyPy
din’t boost performance. This could be due to following reasons.
-
gevent
doesn’t run on PyPy yet. :-(
`` zmq `` library blocks, `` eventlet `` support for zmq is <a href="https://github.com/nanonyme/eventlet-pypy/issues/1" target="_blank">buggy</a>.
`` ujson `` vs `` PyPy `` in built `` json `` performance.
Does any one use PyPy in production
-
Quora runs on pypy but no updates recently.
-
Twisted site run on PyPy.
-
There is a scientfic telescope project that runs on pypy(couldn’t locate the link).
My take
-
Postgres driver
runs without any issues, happy for that.
Waiting for `` gevent `` to support, after that there will be significant progress in speed of brubeck and adoption.
All my personal projects will be tested against pypy. Yes hopes are becoming true.
See also
- Python Typing Koans
- Model Field - Django ORM Working - Part 2
- Structure - Django ORM Working - Part 1
- jut - render jupyter notebook in the terminal
- Five reasons to use Py.test
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.