Recently, thanks to the surprisingly helpful Unhelpful, also known as Andrew Mahone, we have a decent, if slightly arbitrary, set of performances graphs. It contains a couple of benchmarks already seen on this blog as well as some taken from The Great Computer Language Benchmarks Game. These benchmarks don't even try to represent "real applications" as they're mostly small algorithmic benchmarks. Interpreters used:
- PyPy trunk, revision 69331 with --translation-backendopt-storesink, which is now on by default
- Unladen swallow trunk, r900
- CPython 2.6.2 release
Here are the graphs; the benchmarks and the runner script are available
And zoomed in for all benchmarks except binary-trees and fannkuch.As we can see, PyPy is generally somewhere between the same speed as CPython to 50x faster (f1int). The places where we're the same speed as CPython are places where we know we have problems - for example generators are not sped up by the JIT and they require some work (although not as much by far as generators & Psyco :-). The glaring inefficiency is in the regex-dna benchmark. This one clearly demonstrates that our regular expression engine is really, really, bad and urgently requires attention.
The cool thing here is, that although these benchmarks might not represent typical python applications, they're not uninteresting. They show that algorithmic code does not need to be far slower in Python than in C, so using PyPy one need not worry about algorithmic code being dramatically slow. As many readers would agree, that kills yet another usage of C in our lives :-)
Cheers,fijal
Wow! This is getting really interesting. Congratulations!
ReplyDeleteBy the way, it would be great if you include psyco in future graphs, so speed junkies can have a clearer picture of pypy's progress.
Very interesting, congratulations on all the recent progress! It would be very interesting to see how PyPy stacks up against Unladen Swallow on Unladen Swallow's own performance benchmark tests, which do include a bit more real-world scenarios.
ReplyDelete@Eric: yes, definitely, we're approaching that set of benchmarks
ReplyDelete@Luis: yes, definitely, will try to update tomorrow, sorry.
It's good, but...
ReplyDeleteWe are still in the realms of micro-benchmarks. It would be good to compare their performances when working on something larger. Django or Zope maybe?
These last months, you seem to have had almost exponential progress. I guess all those years of research are finally paying off. Congratulations!
ReplyDeleteAlso, another graph for memory pressure would be nice to have. Unladen Shadow is (was?) not very good in that area, and I wonder how PyPy compares.
[nitpick warning]
As a general rule, when mentioning trunk revisions, it's nice to also mention a date so that people know the test was fair. People assume it's from the day you did the tests, and confirming that would be nice.
[/nitpick warning]
How about benchmarking against CPython trunk as well?
ReplyDeletecheers
Antoine.
What about memory consumption? That is almost as important to me as speed.
ReplyDeleteCongratulations !
ReplyDeletePlease could you remember us how to build and test pypy-jit ?
I'm curious why mandelbrot is much less accelerated than, say, nbody. Does PyPy not JIT complex numbers properly yet?
ReplyDelete@wilk ./translate.py -Ojit targetpypystandalone.py
ReplyDelete@Anon Our array module is in pure Python and much less optimized than CPython's.
ReplyDeleteHow long until I can do
ReplyDeletepypy-c-jit translate.py -Ojit targetpypystandalone.py
?
So far, when I try, I get
NameError: global name 'W_NoneObject' is not defined
http://paste.pocoo.org/show/151829/
ASFAIU it's not PyPy's regex engine being "bad" but rather the fact that the JIT generator cannot consider and optimize the loop in the regex engine, as it is a nested loop (the outer one being the bytecode interpretation one).
ReplyDelete@holger: yes, that explains why regexps are not faster in PyPy, but not why they are 5x or 10x slower. Of course our regexp engine is terribly bad. We should have at least a performance similar to CPython.
ReplyDeleteBenjamin, is it really an issue with array? The inner loop just does complex arithmetic. --Anon
ReplyDelete@Anon I'm only guessing. Our math is awfully fast.
ReplyDelete@Anon, @Benjamin
ReplyDeleteI've just noticed that W_ComplexObject in objspace/std/complexobject.py is not marked as _immutable_=True (as it is e.g. W_IntObject), so it is totally possible that the JIT is not able to optimize math with complexes as it does with ints and floats. We should look into it, it is probably easy to discover
guys, sorry, who cares about *seconds*??
ReplyDeletewhy didn't you normalize to the test winners? :)
This comment has been removed by the author.
ReplyDeleteSo, um, has anyone managed to get JIT-ed pypy to compile itself?
ReplyDeleteWhen I tried to do this today, I got this:
http://paste.pocoo.org/show/151829/
@Leo:
ReplyDeleteyes, we know that bug. Armin is fixing it right now on faster-raise branch.
antonio: good point. On the second thought, though, it's not a *really* good point because we don't have _immutable_=True on floats either...
ReplyDelete@Maciej Great! It'll be awesome to have a (hopefully much faster??) JITted build ... it currently takes my computer more than an hour ...
ReplyDelete@Leo it's likely to take tons of memory, though.
ReplyDeleteWould perhaps also be nice to compare the performance with one the current Javascript-Engines(V8, SquirrelFish etc.)
ReplyDeleteNice comparisons - and micro-performance looking good. Congratulations.
ReplyDeleteHOWEVER - there is no value in having three columns for each benchmark. The overall time is arbitrary, all that matters is relative so you might as well normalise all graphs to CPython = 1.0, for example. The relevant informtion is then easier to see!
it's called "The Computer Language
ReplyDeleteBenchmarks Game" these days...
Tom is right, normalizing the graphs to cpython = 1.0 would make them much more readable.
ReplyDeleteAnyway, this is a very good Job from Unhelpful.
Thanks!
Do any of those benchmarks work with shedskin?
ReplyDeleteglad to see someone did something with my language shootout benchmark comment ;)
ReplyDeleteI checked http://www.looking-glass.us/~chshrcat/python-benchmarks/results.txt but it doesn't have the data for unladen swallow. Where are the number?
ReplyDeleteI'm curious why mandelbrot is much less accelerated than, say, nbody. Does PyPy not JIT complex numbers properly yet?
ReplyDelete