[Python-Dev] Linus on garbage collection

Mark Shannon marks at dcs.gla.ac.uk
Fri May 6 16:46:08 CEST 2011

Neal Becker wrote:
> http://gcc.gnu.org/ml/gcc/2002-08/msg00552.html
Being famous does not necessarily make you right.

OS kernels are pretty atypical software,
even if Linus is right about Linux, it doesn't apply to Python.

I have empirical evidence, not opinion, that PyPy and my own HotPy
are a *lot* faster (x5 or better) on Unladen Swallow's gcbench benchmark 
(which stresses the memory management subsystem).

(Note that gcbench does not introduce any cycles, so its being easy on 

In fact, for gcbench CPython spends over twice as long in the 
cycle-collector as HotPy takes in total!
I don't have such detailed results for PyPy.

For other benchmarks, the HotPy GC times are often smaller than the 
inter-run variations in runtime, for example:

HotPy GC stats for pystones (on a slow machine with a small cache):

Total memory allocated: 20 Mbytes.
20 minor collections, 0 major collections
Max heap size 2.4 Mbytes.
Total time spent in GC: 3.5 milliseconds. ( <1% of execution time)

My GC is quick, but its not the fastest.

Evidence trumps opinion IMHO ;)


> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/marks%40dcs.gla.ac.uk

More information about the Python-Dev mailing list