Question

Judging from the benchmarks posted on the PyPy Speed Center it appears as if PyPy is faster than CPython for all but two of the tests presented.

CPython is faster than PyPy on the two tests "slowspitfire" and "waf". Why is that? What kind of operations do those two tests test? What makes CPython faster for those operations? Can PyPy be expected to catch up and beat CPython also for those two tests?

Was it helpful?

Solution

As Tobu said, there's a message on the mailing list that sketches an explanation for slowspitfire: long lists with GC objects in them, among other factors.

The waf benchmark has less of a pronounced difference in performance, and I'd guess that the answer would be more complicated: some factors PyPy does better, some factors CPython does better, and overall CPython comes out slightly ahead.

In general, there are a few reasons a JIT-optimized implementation will come out slower:

  • general overhead in JIT'ing and checking whether to JIT
  • CPU-memory tradeoff: using too much memory to save too little CPU time, or having to use paging more
  • JIT'ing too agressively, or JIT'ing the wrong code at the wrong time
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top