[Python-Dev] Python 2.5 performance

Kristján V. Jónsson kristjan at ccpgames.com
Wed Oct 11 13:29:00 CEST 2006

Hello there.
I just got round to do some comparative runs of 2.5 32 bit Release, built with visual studio 2003 and 2005.
Here the figures (pybench with default arguments)
.NET 2003:
Test                             minimum  average  operation  overhead
          BuiltinFunctionCalls:    262ms    304ms    0.60us    0.251ms
           BuiltinMethodLookup:    232ms    267ms    0.25us    0.312ms
                 CompareFloats:    148ms    170ms    0.14us    0.377ms
         CompareFloatsIntegers:    183ms    216ms    0.24us    0.261ms
               CompareIntegers:    144ms    163ms    0.09us    0.527ms
        CompareInternedStrings:    157ms    186ms    0.12us    1.606ms
                  CompareLongs:    153ms    174ms    0.17us    0.300ms
                CompareStrings:    156ms    198ms    0.20us    1.166ms
                CompareUnicode:    180ms    205ms    0.27us    0.731ms
                 ConcatStrings:    410ms    457ms    0.91us    0.579ms
                 ConcatUnicode:    473ms    610ms    2.03us    0.466ms
               CreateInstances:    248ms    290ms    2.59us    0.432ms
            CreateNewInstances:    206ms    243ms    2.89us    0.352ms
       CreateStringsWithConcat:    164ms    200ms    0.20us    0.971ms
       CreateUnicodeWithConcat:    268ms    295ms    0.74us    0.343ms
                  DictCreation:    152ms    186ms    0.47us    0.358ms
             DictWithFloatKeys:    378ms    410ms    0.46us    0.660ms
           DictWithIntegerKeys:    133ms    161ms    0.13us    0.907ms
            DictWithStringKeys:    152ms    184ms    0.15us    0.927ms
                      ForLoops:    125ms    133ms    5.32us    0.069ms
                    IfThenElse:    109ms    131ms    0.10us    1.019ms
                   ListSlicing:    193ms    223ms   15.90us    0.072ms
                NestedForLoops:    147ms    164ms    0.11us    0.021ms
          NormalClassAttribute:    176ms    195ms    0.16us    0.579ms
       NormalInstanceAttribute:    171ms    198ms    0.17us    0.598ms
           PythonFunctionCalls:    207ms    240ms    0.73us    0.326ms
             PythonMethodCalls:    234ms    287ms    1.27us    0.163ms
                     Recursion:    294ms    328ms    6.56us    0.563ms
                  SecondImport:    191ms    210ms    2.10us    0.241ms
           SecondPackageImport:    197ms    220ms    2.20us    0.217ms
         SecondSubmoduleImport:    257ms    276ms    2.76us    0.213ms
       SimpleComplexArithmetic:    191ms    208ms    0.24us    0.445ms
        SimpleDictManipulation:    158ms    178ms    0.15us    0.625ms
         SimpleFloatArithmetic:    183ms    211ms    0.16us    0.703ms
      SimpleIntFloatArithmetic:    122ms    133ms    0.10us    0.745ms
       SimpleIntegerArithmetic:    106ms    121ms    0.09us    0.680ms
        SimpleListManipulation:    132ms    149ms    0.13us    0.750ms
          SimpleLongArithmetic:    170ms    198ms    0.30us    0.322ms
                    SmallLists:    246ms    274ms    0.40us    0.437ms
                   SmallTuples:    204ms    235ms    0.43us    0.497ms
         SpecialClassAttribute:    177ms    201ms    0.17us    0.561ms
      SpecialInstanceAttribute:    257ms    290ms    0.24us    0.598ms
                StringMappings:    881ms    949ms    3.77us    0.584ms
              StringPredicates:    321ms    366ms    0.52us    3.207ms
                 StringSlicing:    243ms    286ms    0.51us    1.032ms
                     TryExcept:     87ms    110ms    0.05us    0.957ms
                TryRaiseExcept:    164ms    197ms    3.08us    0.434ms
                  TupleSlicing:    195ms    230ms    0.88us    0.065ms
               UnicodeMappings:    158ms    187ms    5.20us    0.699ms
             UnicodePredicates:    191ms    233ms    0.43us    3.954ms
             UnicodeProperties:    209ms    251ms    0.63us    3.234ms
                UnicodeSlicing:    306ms    345ms    0.70us    0.933ms
Totals:                          11202ms  12875ms
.NET 2005:
Test                             minimum  average  operation  overhead
          BuiltinFunctionCalls:    254ms    279ms    0.55us    0.280ms
           BuiltinMethodLookup:    269ms    290ms    0.28us    0.327ms
                 CompareFloats:    136ms    147ms    0.12us    0.375ms
         CompareFloatsIntegers:    158ms    178ms    0.20us    0.268ms
               CompareIntegers:    118ms    141ms    0.08us    0.603ms
        CompareInternedStrings:    152ms    203ms    0.14us    1.666ms
                  CompareLongs:    152ms    171ms    0.16us    0.335ms
                CompareStrings:    118ms    140ms    0.14us    1.374ms
                CompareUnicode:    160ms    180ms    0.24us    0.730ms
                 ConcatStrings:    430ms    472ms    0.94us    0.681ms
                 ConcatUnicode:    488ms    535ms    1.78us    0.458ms
               CreateInstances:    249ms    286ms    2.56us    0.437ms
            CreateNewInstances:    220ms    254ms    3.02us    0.356ms
       CreateStringsWithConcat:    174ms    204ms    0.20us    1.123ms
       CreateUnicodeWithConcat:    271ms    294ms    0.74us    0.348ms
                  DictCreation:    151ms    169ms    0.42us    0.365ms
             DictWithFloatKeys:    350ms    387ms    0.43us    0.666ms
           DictWithIntegerKeys:    140ms    151ms    0.13us    1.020ms
            DictWithStringKeys:    154ms    176ms    0.15us    1.070ms
                      ForLoops:     96ms    111ms    4.42us    0.069ms
                    IfThenElse:    115ms    130ms    0.10us    0.697ms
                   ListSlicing:    221ms    261ms   18.66us    0.093ms
                NestedForLoops:    146ms    167ms    0.11us    0.022ms
          NormalClassAttribute:    182ms    205ms    0.17us    0.502ms
       NormalInstanceAttribute:    174ms    192ms    0.16us    0.457ms
           PythonFunctionCalls:    203ms    221ms    0.67us    0.337ms
             PythonMethodCalls:    266ms    309ms    1.37us    0.149ms
                     Recursion:    286ms    329ms    6.57us    0.459ms
                  SecondImport:    170ms    197ms    1.97us    0.181ms
           SecondPackageImport:    187ms    215ms    2.15us    0.178ms
         SecondSubmoduleImport:    243ms    275ms    2.75us    0.215ms
       SimpleComplexArithmetic:    177ms    199ms    0.23us    0.370ms
        SimpleDictManipulation:    159ms    185ms    0.15us    0.498ms
         SimpleFloatArithmetic:    177ms    196ms    0.15us    1.502ms
      SimpleIntFloatArithmetic:    109ms    126ms    0.10us    0.574ms
       SimpleIntegerArithmetic:    108ms    124ms    0.09us    0.611ms
        SimpleListManipulation:    145ms    169ms    0.14us    0.619ms
          SimpleLongArithmetic:    167ms    190ms    0.29us    0.324ms
                    SmallLists:    247ms    274ms    0.40us    0.339ms
                   SmallTuples:    204ms    224ms    0.42us    0.429ms
         SpecialClassAttribute:    193ms    216ms    0.18us    0.558ms
      SpecialInstanceAttribute:    255ms    280ms    0.23us    0.470ms
                StringMappings:    297ms    321ms    1.28us    0.474ms
              StringPredicates:    229ms    274ms    0.39us    3.892ms
                 StringSlicing:    238ms    258ms    0.46us    0.962ms
                     TryExcept:     86ms    102ms    0.05us    0.755ms
                TryRaiseExcept:    155ms    173ms    2.70us    0.357ms
                  TupleSlicing:    188ms    217ms    0.83us    0.050ms
               UnicodeMappings:    103ms    118ms    3.29us    0.595ms
             UnicodePredicates:    176ms    207ms    0.38us    3.950ms
             UnicodeProperties:    187ms    212ms    0.53us    3.228ms
                UnicodeSlicing:    312ms    342ms    0.70us    0.834ms
Totals:                          10343ms  11677ms
This is an improvement of more than 7%.
In addition, here is a run of the PGO optimized .NET 2005:
Test                             minimum  average  operation  overhead
          BuiltinFunctionCalls:    232ms    250ms    0.49us    0.330ms
           BuiltinMethodLookup:    276ms    296ms    0.28us    0.382ms
                 CompareFloats:    130ms    142ms    0.12us    0.451ms
         CompareFloatsIntegers:    150ms    166ms    0.18us    0.326ms
               CompareIntegers:    130ms    155ms    0.09us    0.729ms
        CompareInternedStrings:    152ms    197ms    0.13us    1.947ms
                  CompareLongs:    136ms    146ms    0.14us    0.390ms
                CompareStrings:    151ms    174ms    0.17us    1.583ms
                CompareUnicode:    131ms    167ms    0.22us    0.965ms
                 ConcatStrings:    417ms    485ms    0.97us    0.681ms
                 ConcatUnicode:    483ms    551ms    1.84us    0.484ms
               CreateInstances:    224ms    252ms    2.25us    0.600ms
            CreateNewInstances:    186ms    216ms    2.58us    0.407ms
       CreateStringsWithConcat:    155ms    175ms    0.18us    1.264ms
       CreateUnicodeWithConcat:    275ms    306ms    0.76us    0.437ms
                  DictCreation:    160ms    186ms    0.47us    0.443ms
             DictWithFloatKeys:    349ms    375ms    0.42us    0.924ms
           DictWithIntegerKeys:    143ms    173ms    0.14us    1.296ms
            DictWithStringKeys:    157ms    177ms    0.15us    1.184ms
                      ForLoops:    140ms    155ms    6.21us    0.074ms
                    IfThenElse:    107ms    127ms    0.09us    0.955ms
                   ListSlicing:    217ms    256ms   18.29us    0.103ms
                NestedForLoops:    166ms    194ms    0.13us    0.018ms
          NormalClassAttribute:    163ms    179ms    0.15us    0.564ms
       NormalInstanceAttribute:    151ms    169ms    0.14us    0.536ms
           PythonFunctionCalls:    210ms    235ms    0.71us    0.313ms
             PythonMethodCalls:    237ms    260ms    1.15us    0.167ms
                     Recursion:    285ms    334ms    6.68us    0.538ms
                  SecondImport:    147ms    169ms    1.69us    0.243ms
           SecondPackageImport:    155ms    200ms    2.00us    0.215ms
         SecondSubmoduleImport:    202ms    234ms    2.34us    0.203ms
       SimpleComplexArithmetic:    162ms    187ms    0.21us    0.446ms
        SimpleDictManipulation:    162ms    181ms    0.15us    0.627ms
         SimpleFloatArithmetic:    171ms    201ms    0.15us    1.335ms
      SimpleIntFloatArithmetic:    119ms    137ms    0.10us    0.659ms
       SimpleIntegerArithmetic:    114ms    128ms    0.10us    0.668ms
        SimpleListManipulation:    145ms    161ms    0.14us    0.764ms
          SimpleLongArithmetic:    161ms    178ms    0.27us    0.423ms
                    SmallLists:    234ms    271ms    0.40us    0.454ms
                   SmallTuples:    182ms    203ms    0.38us    0.497ms
         SpecialClassAttribute:    174ms    201ms    0.17us    0.716ms
      SpecialInstanceAttribute:    230ms    252ms    0.21us    0.558ms
                StringMappings:    285ms    313ms    1.24us    0.514ms
              StringPredicates:    233ms    275ms    0.39us    3.475ms
                 StringSlicing:    225ms    242ms    0.43us    1.037ms
                     TryExcept:     78ms     89ms    0.04us    0.961ms
                TryRaiseExcept:    133ms    156ms    2.44us    0.454ms
                  TupleSlicing:    186ms    202ms    0.77us    0.078ms
               UnicodeMappings:    103ms    118ms    3.29us    0.520ms
             UnicodePredicates:    186ms    216ms    0.40us    3.414ms
             UnicodeProperties:    180ms    214ms    0.54us    2.530ms
                UnicodeSlicing:    299ms    318ms    0.65us    0.815ms
Totals:                           9974ms  11345ms
This is an improvement of another 3.5 %.
In all, we have a performance increase of more than 10%.
Granted, this is from a single set of runs, but I think we should start considering to make PCBuild8 a "supported" build.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20061011/49a0c38e/attachment-0001.htm 

More information about the Python-Dev mailing list