[Python-Dev] Re: Python 2.1 slower than 2.0

M.-A. Lemburg mal@lemburg.com
Mon, 29 Jan 2001 14:18:52 +0100


"M.-A. Lemburg" wrote:
> 
> Fredrik Lundh wrote:
> >
> > mal wrote:
> > >                UnicodeMappings:    1631.65 ms   90.65 us  +42.76%
> > >              UnicodePredicates:    1762.10 ms    7.83 us  +15.99%
> > >              UnicodeProperties:    1410.80 ms    7.05 us  +19.57%
> > >                 UnicodeSlicing:    1366.20 ms    7.81 us  +19.23%
> > >
> > > Unicode mappings and other Unicode database related methods
> > > show the effect of the compression of the Unicode database -- a
> > > clear space/speed tradeoff.
> >
> > umm.  the tests don't seem to test the "\N{name}" escapes, so the
> > only thing that has changed in 2.1 is the "decomposition" method
> > (used in the UnicodeProperties test).
> 
> The mappings figure surprised me too: the code has not changed,
> but the unicodetype_db.h look different. Don't know how this
> affects performance though.
> 
> The differences could also be explained by a increase in Unicode
> object creation time (the concatenation is also a lot slower),
> so perhaps that's where we should look...
> 
> > are you sure you're comparing against 2.0 final?
> 
> Yes... after a check of the Makefile I found that I had compiled
> Python 2.0 with -O3 and 2.1a1 with -O2 -- perhaps this makes
> a difference w/r to inlining of code. I'll recompile and rerun
> the benchmark.

Looks like there is an effect of choosing -O3 over -O2 (even though
not necessarily positive all the way); what results do you get on
Windows ?

--

PYBENCH 0.7

Benchmark: /home/lemburg/tmp/pybench-2.1a1.pyb (rounds=10, warp=20)

Tests:                              per run    per oper.  diff *
------------------------------------------------------------------------
          BuiltinFunctionCalls:    1065.10 ms    8.35 us   +3.93%
           BuiltinMethodLookup:    1286.30 ms    2.45 us  +39.12%
                 ConcatStrings:    1243.30 ms    8.29 us  +15.80%
                 ConcatUnicode:    1449.10 ms    9.66 us   -5.83%
               CreateInstances:    1639.25 ms   39.03 us   +7.95%
       CreateStringsWithConcat:    1453.45 ms    7.27 us   +9.73%
       CreateUnicodeWithConcat:    1558.45 ms    7.79 us   +8.19%
                  DictCreation:    1869.35 ms   12.46 us   +8.77%
                      ForLoops:    1526.85 ms  152.69 us   -1.03%
                    IfThenElse:    1381.00 ms    2.05 us  +12.09%
                   ListSlicing:     547.40 ms  156.40 us   -5.52%
                NestedForLoops:     824.50 ms    2.36 us   -1.56%
          NormalClassAttribute:    1233.55 ms    2.06 us   +4.96%
       NormalInstanceAttribute:    1215.50 ms    2.03 us  +16.37%
           PythonFunctionCalls:    1107.30 ms    6.71 us  +10.55%
             PythonMethodCalls:    1047.00 ms   13.96 us  +26.34%
                     Recursion:     940.35 ms   75.23 us  +23.47%
                  SecondImport:     894.05 ms   35.76 us   +0.59%
           SecondPackageImport:     915.05 ms   36.60 us   +2.14%
         SecondSubmoduleImport:    1131.10 ms   45.24 us   +0.56%
       SimpleComplexArithmetic:    1652.05 ms    7.51 us   +6.67%
        SimpleDictManipulation:    1150.25 ms    3.83 us  +18.72%
         SimpleFloatArithmetic:     889.65 ms    1.62 us   -1.52%
      SimpleIntFloatArithmetic:     900.80 ms    1.36 us   -0.40%
       SimpleIntegerArithmetic:     901.75 ms    1.37 us   -0.72%
        SimpleListManipulation:    1125.40 ms    4.17 us   +4.15%
          SimpleLongArithmetic:    1305.15 ms    7.91 us   +7.62%
                    SmallLists:    2102.85 ms    8.25 us   +8.18%
                   SmallTuples:    1329.55 ms    5.54 us   +4.98%
         SpecialClassAttribute:    1234.60 ms    2.06 us  +19.23%
      SpecialInstanceAttribute:    1422.55 ms    2.37 us  +11.28%
                StringMappings:    1585.55 ms   12.58 us  +11.46%
              StringPredicates:    1241.35 ms    4.43 us   -9.69%
                 StringSlicing:    1206.20 ms    6.89 us  +15.12%
                     TryExcept:    1764.35 ms    1.18 us   -0.81%
                TryRaiseExcept:    1217.40 ms   81.16 us   +2.77%
                  TupleSlicing:     933.00 ms    8.89 us   -1.90%
               UnicodeMappings:    1137.35 ms   63.19 us   -0.49%
             UnicodePredicates:    1632.05 ms    7.25 us   +7.43%
             UnicodeProperties:    1244.05 ms    6.22 us   +5.44%
                UnicodeSlicing:    1252.10 ms    7.15 us   +9.27%
------------------------------------------------------------------------
            Average round time:   58804.00 ms              +4.73%

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

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