Thursday, February 17

Geek

Go Go Gadget Gnu Compiler Team!

I was just trying to confirm some confusing benchmark results, when I discovered something:

Python compiled with GCC 4.4.5 runs up to 50% faster than Python compiled with GCC 4.1.2.

Eineus runs CentOS 5 with the older version of GCC; Futaba runs Fedora 13 with the newer version.  Both are 32-bit and have Python 2.6.6 compiled from source.  (And they're OpenVZ VMs on the same host, so no hardware differences at all.)

[andrew@eineus ~]$ python test.py
Native
Loop: 0.943
String: 1.490
Scan: 0.547
Total: 2.980

[andrew@futaba ~]$ python test.py
Native
Loop: 0.600
String: 1.070
Scan: 0.537
Total: 2.207

That's good to know.

Psyco results don't vary much, since that has its own compiler.  But for some reason, the string scanning benchmark, which ran measurably slower under Psyco before, is now pretty much equal in speed to native Python.

It's a shame that Psyco has been pretty much abandoned; I understand that the code is unlovely cruft, but it's an incredibly useful tool.

Update: You can see how things have evolved over time with respect to CPU and compiler speeds:

All My Servers Are No Longer The Same Speed (2010)
All My Servers Are The Same Speed (2006)

Update: Did some more testing.  Python 2.6.6 compiled with GCC 4.4 on x64 averages 50% faster than the same version compiled with GCC 4.1 on x86.  It's pretty consistent across the board, too.

Posted by: Pixy Misa at 04:05 AM | No Comments | Add Comment | Trackbacks (Suck)
Post contains 234 words, total size 2 kb.

Comments are disabled. Post is locked.
45kb generated in CPU 0.0158, elapsed 0.311 seconds.
54 queries taking 0.3015 seconds, 335 records returned.
Powered by Minx 1.1.6c-pink.