[pypy-dev] PyPy is much slower than CPython example / question
stefan_ml at behnel.de
Sat Jul 9 06:26:46 CEST 2011
Armin Rigo, 08.07.2011 11:18:
> Before attacking the problem with the JIT, we should understand better
> why PyPy is 4-8 times slower than CPython. Normally you'd expect the
> factor to be at most 2. I suppose the answer is that our
> itertools.repeat() is bad for some reason.
You shouldn't forget that itertools contains extremely well optimised C
code. I recently tried to (algorithmically) optimise the pure Python
implementations from the CPython docs for Cython, and ended up with timings
between 10% faster and 50% slower. It's actually hard to reach up to the
raw power of hand tuned C code here.
Given that some of the functions don't execute anything more than a couple
of assembly instructions per cycle, you'll have to send a really well tuned
high level implementation into the race to even come close. I would expect
that PyPy's implementation simply wasn't written for that.
That being said, it would be nice to have an itertools micro benchmark for
the common Python test suite.
More information about the pypy-dev