A brief experiment with PyPy
lwn.net
lwn.net
Tried it today with a tpc-c trace which has about 500 million accesses. The result: CPython would have run for about 90 minutes (I stopped it after 30 minutes, and began to look for a speedier possibility), PyPy only took 22 minutes.
As for me, the main reason I haven't moved to PyPy yet is the lack of database and messaging support.
By messaging, I mean something like RabbitMQ, that way I can have batch scheduling at a little bit more sophisticated grain than "run a cronjob".
But.... I just tried "import multiprocessing" in PyPy 1.5 and it worked! Is this all part of the C-API compatability layer? Does that mean Cython code may soon work in PyPy too (that's my pony feature)?
RabbitMQ should work under PyPy currently then, all of its dependencies purport to be pure python. ---
Another RabbitMQ lib is Rabbitmq-c which is direct wrapping around librabbitmq-c. It ecks out extra performance vs pure python rabbitmq, but mostly it isn't needed.
I just compiled it today and it works.
It's interesting that Guido deliberately didn't go for a full re write for python 3, but this project which is a full rewrite in a whole different language has provided a faster implementation with less developers!
Since the benefits have been proven, I can't help but wonder why there aren't more people working on this...
* volunteers are interested somewhere else
* nobody is willing to put money into numpy on pypy happening
The big win of PyPy vs. Cython is that you get a 10x or so speed improvement without having to specify types, but if you're using NumPy already, then its pretty standard to specify types already so NumPy can optimize. At that point, you really have to ask yourself if it isn't worth it to just build a Cython module and get next to C speed for that hotspot.
The great thing about Cython is that it lets you call inbetween C and Python at little overhead without having to write any code for the Python C-API like you would if you were using CTypes or even Boost::Python.
One of my use cases for Python is relatively small, short-running scripts, and JIT engines often take a fair amount of runtime before all the optimizations kick in. So I wonder how PyPy does at startup time and whether it's able to leverage its execution speed prowess over brief runtimes - is it still a net performance win in the end, or at least not-worse-than-CPython?
How's performance while the JIT is not yet warmed up, compared to CPython?