A couple garbage collector questions
Neil Schemenauer
nas at python.ca
Wed Apr 4 21:31:06 EDT 2001
Fredrik Lundh wrote:
> lots of people have played with that. nobody has been able to make
> Python+Boehm run faster than reference counting plus Neil's approach.
I thought maybe the situation has changed so I tried again with libgc
5.3 and Python 2.1b2+. I removed ob_refcnt from the object structure
and all other related code. I also had to disable the integer, float,
and method object freelists. The results were fairly discouraging.
Python 2.1b2 with reference counting and reference cycle GC:
Pystone(1.1) time for 10000 passes = 1.09
This machine benchmarks at 9174.31 pystones/second
Python 2.1b2+ (from CVS) with mark and sweep GC:
Pystone(1.1) time for 10000 passes = 2.45
This machine benchmarks at 4081.63 pystones/second
pybench gives similar results:
Tests: per run per oper. diff *
------------------------------------------------------------------------
BuiltinFunctionCalls: 280.75 ms 2.20 us +11.52%
BuiltinMethodLookup: 508.50 ms 0.97 us +67.68%
ConcatStrings: 1830.37 ms 12.20 us +520.99%
CreateInstances: 518.50 ms 12.35 us +29.42%
CreateStringsWithConcat: 465.50 ms 2.33 us +32.95%
DictCreation: 336.62 ms 2.24 us -22.32%
ForLoops: 696.50 ms 69.65 us +60.25%
IfThenElse: 314.12 ms 0.47 us -9.21%
ListSlicing: 336.00 ms 96.00 us +117.30%
NestedForLoops: 349.63 ms 1.00 us +47.29%
NormalClassAttribute: 291.75 ms 0.49 us -10.13%
NormalInstanceAttribute: 294.62 ms 0.49 us -5.64%
PythonFunctionCalls: 1246.75 ms 7.56 us +279.53%
PythonMethodCalls: 698.62 ms 9.31 us +191.85%
Recursion: 974.25 ms 77.94 us +345.88%
SecondImport: 189.00 ms 7.56 us -13.90%
SecondPackageImport: 198.87 ms 7.95 us -12.39%
SecondSubmoduleImport: 246.25 ms 9.85 us -12.68%
SimpleComplexArithmetic: 257.88 ms 1.17 us -34.92%
SimpleDictManipulation: 324.12 ms 1.08 us +10.39%
SimpleFloatArithmetic: 399.75 ms 0.73 us +52.43%
SimpleIntFloatArithmetic: 431.00 ms 0.65 us +66.17%
SimpleIntegerArithmetic: 418.37 ms 0.63 us +56.92%
SimpleListManipulation: 379.00 ms 1.40 us +31.43%
SimpleLongArithmetic: 200.75 ms 1.22 us -40.39%
SmallLists: 397.62 ms 1.56 us -36.78%
SmallTuples: 388.00 ms 1.62 us +15.78%
SpecialClassAttribute: 292.12 ms 0.49 us -8.64%
SpecialInstanceAttribute: 346.75 ms 0.58 us -4.28%
StringSlicing: 573.62 ms 3.28 us +101.98%
TryExcept: 468.75 ms 0.31 us -0.69%
TryRaiseExcept: 239.13 ms 15.94 us -17.72%
TupleSlicing: 423.50 ms 4.03 us +82.64%
------------------------------------------------------------------------
Average round time: 18027.50 ms +52.23%
*) measured against: rc (rounds=4, warp=20)
I think a generational, copying collector would be fast. However, a
copying collector moves objects (goodbye easy extendablity). Doing
generational collection requires support from the OS (goodbye
portability and goodbye Pippy).
Neil
More information about the Python-list
mailing list