Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How come CPython is faster than PyPy on the two tests "slowspitfire" and "waf"?

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?

like image 496
knorv Avatar asked Apr 30 '11 18:04

knorv


1 Answers

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
like image 144
Mu Mind Avatar answered Sep 21 '22 15:09

Mu Mind