I've just been testing out Jakob Sievers' speedup of Python 2.5.2 by
compiling on freebsd with gcc-4.3.3 (the standard freebsd 6.1 gcc is 3.4.4).
I'm glad to say that his modification did improve pybench overall by
about 12%, but during the testing I noticed that in fact some of the
pybench results were much worse using gcc-4.3.3 compared to gcc-3.4.4.
Of course it may be that freebsd has put more work into 3.4.4, but when
I did a direct comparison of stock Python-2.5.2 under both compilers I
see the results below which seems to indicate some quite large
differences in how the compilers perform and the older one is better
overall by about 6%. Is there a best version of gcc for python?
-------------------------------------------------------------------------------
PYBENCH 2.0
-------------------------------------------------------------------------------
* using Python 2.5.2
* disabled garbage collection
* system check interval set to maximum: 2147483647
* using timer: time.time
Calibrating tests. Please wait...
Running 10 round(s) of the suite at warp factor 10:
* Round 1 done in 9.697 seconds.
* Round 2 done in 9.746 seconds.
* Round 3 done in 9.631 seconds.
* Round 4 done in 9.646 seconds.
* Round 5 done in 9.727 seconds.
* Round 6 done in 9.649 seconds.
* Round 7 done in 9.759 seconds.
* Round 8 done in 9.660 seconds.
* Round 9 done in 9.661 seconds.
* Round 10 done in 9.671 seconds.
-------------------------------------------------------------------------------
Benchmark: 2008-11-16 12:22:59
-------------------------------------------------------------------------------
Rounds: 10
Warp: 10
Timer: time.time
Machine Details:
Platform ID: FreeBSD-6.1-SECURITY-i386-32bit
Processor: i386
Python:
Executable: /home/rptlab/bin/python25
Version: 2.5.2
Compiler: GCC 3.4.4 [FreeBSD
Bits: 32bit
Build: Nov 16 2008 12:15:52 (#r252:60911)
Unicode: UCS2
-------------------------------------------------------------------------------
Comparing with: pybench.ref.x
-------------------------------------------------------------------------------
Rounds: 10
Warp: 10
Timer: time.time
Machine Details:
Platform ID: FreeBSD-6.1-SECURITY-i386-32bit
Processor: i386
Python:
Executable: /home/rptlab/bin/xpython
Version: 2.5.2
Compiler: GCC 4.3.3 20081106 (prerelease)
Bits: 32bit
Build: Nov 16 2008 11:38:57 (#r252:60911)
Unicode: UCS2
Test minimum run-time average run-time
this other diff this other diff
-------------------------------------------------------------------------------
BuiltinFunctionCalls: 202ms 209ms -3.6% 205ms 213ms -3.7%
BuiltinMethodLookup: 153ms 146ms +5.2% 156ms 146ms +6.7%
CompareFloats: 134ms 149ms -9.6% 134ms 149ms -9.6%
CompareFloatsIntegers: 132ms 147ms -9.9% 132ms 147ms -9.9%
CompareIntegers: 131ms 173ms -24.4% 131ms 173ms -24.4%
CompareInternedStrings: 130ms 142ms -7.8% 131ms 142ms -7.7%
CompareLongs: 113ms 146ms -23.1% 113ms 146ms -23.1%
CompareStrings: 138ms 138ms -0.1% 138ms 138ms -0.5%
CompareUnicode: 126ms 130ms -2.8% 126ms 130ms -3.3%
ConcatStrings: 233ms 422ms -44.9% 254ms 452ms -43.9%
ConcatUnicode: 187ms 300ms -37.5% 193ms 340ms -43.3%
CreateInstances: 147ms 159ms -7.5% 148ms 160ms -7.6%
CreateNewInstances: 132ms 138ms -4.9% 132ms 139ms -4.7%
CreateStringsWithConcat: 176ms 174ms +1.4% 177ms 174ms +1.4%
CreateUnicodeWithConcat: 143ms 154ms -7.3% 147ms 156ms -5.6%
DictCreation: 118ms 150ms -21.1% 119ms 151ms -21.1%
DictWithFloatKeys: 163ms 178ms -8.5% 163ms 178ms -8.4%
DictWithIntegerKeys: 123ms 137ms -10.5% 123ms 138ms -10.7%
DictWithStringKeys: 117ms 136ms -13.7% 118ms 136ms -13.6%
ForLoops: 111ms 122ms -9.0% 111ms 123ms -9.8%
IfThenElse: 121ms 132ms -7.8% 121ms 132ms -8.1%
ListSlicing: 115ms 115ms +0.6% 116ms 115ms +0.8%
NestedForLoops: 138ms 145ms -4.8% 139ms 145ms -4.3%
NormalClassAttribute: 142ms 140ms +1.2% 144ms 141ms +2.3%
NormalInstanceAttribute: 136ms 133ms +2.5% 137ms 134ms +2.2%
PythonFunctionCalls: 128ms 133ms -3.8% 128ms 133ms -4.0%
PythonMethodCalls: 162ms 173ms -6.2% 163ms 174ms -6.7%
Recursion: 175ms 180ms -2.8% 175ms 181ms -3.1%
SecondImport: 222ms 213ms +4.2% 224ms 213ms +5.0%
SecondPackageImport: 230ms 220ms +4.5% 232ms 221ms +5.0%
SecondSubmoduleImport: 279ms 263ms +5.9% 280ms 263ms +6.1%
SimpleComplexArithmetic: 143ms 148ms -3.7% 143ms 148ms -3.6%
SimpleDictManipulation: 132ms 139ms -5.5% 133ms 140ms -5.2%
SimpleFloatArithmetic: 128ms 128ms +0.2% 130ms 129ms +0.6%
SimpleIntFloatArithmetic: 110ms 113ms -2.2% 110ms 113ms -2.2%
SimpleIntegerArithmetic: 110ms 113ms -2.2% 110ms 113ms -2.2%
SimpleListManipulation: 114ms 124ms -7.8% 115ms 125ms -7.5%
SimpleLongArithmetic: 121ms 121ms -0.3% 121ms 122ms -0.5%
SmallLists: 138ms 143ms -3.3% 140ms 149ms -5.9%
SmallTuples: 149ms 159ms -6.1% 153ms 159ms -4.2%
SpecialClassAttribute: 141ms 138ms +2.1% 141ms 139ms +2.0%
SpecialInstanceAttribute: 227ms 216ms +5.2% 227ms 216ms +5.3%
StringMappings: 1827ms 1796ms +1.7% 1828ms 1798ms +1.7%
StringPredicates: 378ms 369ms +2.3% 378ms 369ms +2.3%
StringSlicing: 140ms 179ms -21.7% 145ms 185ms -21.6%
TryExcept: 111ms 112ms -0.7% 111ms 112ms -0.8%
TryRaiseExcept: 130ms 124ms +4.7% 131ms 125ms +4.6%
TupleSlicing: 130ms 134ms -2.9% 133ms 135ms -1.5%
UnicodeMappings: 125ms 123ms +0.8% 126ms 124ms +1.8%
UnicodePredicates: 135ms 132ms +2.3% 136ms 133ms +2.1%
UnicodeProperties: 199ms 201ms -1.2% 199ms 202ms -1.2%
UnicodeSlicing: 156ms 233ms -33.2% 166ms 244ms -32.2%
-------------------------------------------------------------------------------
Totals: 9601ms 10240ms -6.2% 9685ms 10363ms -6.5%
--
Robin Becker
--
http://mail.python.org/mailman/listinfo/python-list