[Python-Dev] New benchmark results (2.1a2 vs. 2.0)

M.-A. Lemburg mal@lemburg.com
Wed, 07 Feb 2001 16:32:29 +0100


I reran the benchmark I posted a couple of days ago against the
current CVS tree. Here are the results (this time I double checked
that both version were compiled using the same compiler settings)
on my AMD K6 (I gave back the AMK K6 to Andrew :-). 

This time I ran the benchmark with Python in -O mode which should
give better performance characteristics:

PYBENCH 0.8

Benchmark: tmp/pybench-2.1a2-O.pyb (rounds=10, warp=20)

Tests:                              per run    per oper.  diff *
------------------------------------------------------------------------
          BuiltinFunctionCalls:    1080.60 ms    8.48 us   +7.91%
           BuiltinMethodLookup:    1185.60 ms    2.26 us  +47.86%
                 ConcatStrings:    1157.75 ms    7.72 us  +10.03%
                 ConcatUnicode:    1398.80 ms    9.33 us   +8.76%
               CreateInstances:    1694.30 ms   40.34 us  +12.08%
       CreateStringsWithConcat:    1393.90 ms    6.97 us   +9.75%
       CreateUnicodeWithConcat:    1487.90 ms    7.44 us   +7.81%
                  DictCreation:    1794.45 ms   11.96 us   +4.22%
             DictWithFloatKeys:    2102.75 ms    3.50 us  +18.03%
           DictWithIntegerKeys:    1107.80 ms    1.85 us  +13.33%
            DictWithStringKeys:     892.80 ms    1.49 us   -2.39%
                      ForLoops:    1145.95 ms  114.59 us   -0.00%
                    IfThenElse:    1229.60 ms    1.82 us  +15.67%
                   ListSlicing:     551.75 ms  157.64 us   +2.23%
                NestedForLoops:     649.65 ms    1.86 us   -0.60%
          NormalClassAttribute:    1253.35 ms    2.09 us  +29.57%
       NormalInstanceAttribute:    1394.25 ms    2.32 us  +51.52%
           PythonFunctionCalls:     942.45 ms    5.71 us  -10.22%
             PythonMethodCalls:     975.30 ms   13.00 us  +14.33%
                     Recursion:     770.35 ms   61.63 us   -0.42%
                  SecondImport:     855.50 ms   34.22 us   -1.37%
           SecondPackageImport:     869.40 ms   34.78 us   -2.56%
         SecondSubmoduleImport:    1075.40 ms   43.02 us   -3.93%
       SimpleComplexArithmetic:    1632.95 ms    7.42 us   +7.04%
        SimpleDictManipulation:    1018.15 ms    3.39 us  +11.44%
         SimpleFloatArithmetic:     782.25 ms    1.42 us   +0.49%
      SimpleIntFloatArithmetic:     770.70 ms    1.17 us   +0.93%
       SimpleIntegerArithmetic:     769.85 ms    1.17 us   +0.82%
        SimpleListManipulation:    1097.35 ms    4.06 us  +13.16%
          SimpleLongArithmetic:    1274.80 ms    7.73 us   +8.27%
                    SmallLists:    1982.30 ms    7.77 us   +5.20%
                   SmallTuples:    1259.90 ms    5.25 us   +3.87%
         SpecialClassAttribute:    1265.35 ms    2.11 us  +33.74%
      SpecialInstanceAttribute:    1694.35 ms    2.82 us  +51.38%
                StringMappings:    1483.15 ms   11.77 us   +8.04%
              StringPredicates:    1205.05 ms    4.30 us   -4.89%
                 StringSlicing:    1158.00 ms    6.62 us  +12.65%
                     TryExcept:    1128.70 ms    0.75 us   -1.22%
                TryRaiseExcept:    1199.50 ms   79.97 us   +6.45%
                  TupleSlicing:     971.40 ms    9.25 us  +10.99%
               UnicodeMappings:    1111.15 ms   61.73 us   -2.04%
             UnicodePredicates:    1307.20 ms    5.81 us   -7.54%
             UnicodeProperties:    1228.05 ms    6.14 us   +8.81%
                UnicodeSlicing:    1032.95 ms    5.90 us   -7.52%
------------------------------------------------------------------------
            Average round time:   59476.00 ms              +6.18%

*) measured against: tmp/pybench-2.0-O.pyb (rounds=10, warp=20)

The version 0.8 pybench archive can be downloaded from:

	http://www.lemburg.com/python/pybench-0.8.zip

It includes two new test for special dictionary keys.

What's interesting here is that attribute lookups seem to have
suffered (I consider figures above ~10% to be significant)
while Python function calls got faster. The new dictionary key
tests nicely show the effect of the string optimization compared
to the standard lookup scheme which applies lots of error
checking. OTOH, it is surprising that attribute lookup got
a slowdown since these normally are string lookups in 
dictionaries...

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company:                                        http://www.egenix.com/
Consulting:                                    http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/