I've stumbled across a peculiar performance issue with Pypy across some 
platforms. It was very visible in some calculation heavy code that I wrote that 
Python's complex number type to calculate the well-known Mandelbrot set.

Pypy running the code on my Windows machine is doing okay, but when running the 
code on Pypy on different systems, the performance difference is so big it is 
not even
funny. The other implementations are MUCH faster than the windows one. Which is 
unexpected because the other machines I've tested on have the same or much lower
physical CPU specs than the windows machine.  Here's the comparison:

Machine specs:
 Windows: 64 bits Windows 7, Intel Core 2 Quad 3.4 Ghz
 Linux: 32 bits Mint 18, Virtualbox VM on above windows machine
 Mac mini: OS X 10.11.6, Intel Core 2 Duo 2.53 Ghz

The test code I've been using is here:

Test results:
                      function:  mandel   / iterations
 Mac mini, Pypy 5.4.1 (64-bit):  0.81 sec / 0.65 sec
 Linux, Pypy 5.1 (32-bit):       1.06 sec / 0.64 sec
 Windows, Pypy 5.4.1 (32-bit):   5.59 sec / 2.87 sec

What could cause such a huge difference?

Is it perhaps a compiler issue (where gcc/clang are MUCH better at optimizing 
things, although I wonder how much of a factor this is because Pypy is doing 
JITting by
itself as far as I am aware)?   Or is something strange going on with the way 
complex number type is implemented?   (the difference doesn't occur when using 
only floats)

Irmen de Jong


Reply via email to