[Python-3000] Delayed reference counting idea
Antoine Pitrou
solipsis at pitrou.net
Mon Sep 18 20:38:00 CEST 2006
Le lundi 18 septembre 2006 à 09:48 -0600, Adam Olsen a écrit :
> * Bolt-on tracing GC such as Boehm-Demers-Weiser. Totally unsupported
> by the C standards and changes cache characteristics that CPython has
> been designed with for years, likely with a very large performance
> penalty.
Has it been measured what cache effects reference counting entails ?
With reference counting, each object is mutable from the point of view
of the CPU cache (refcnt is always incremented and later decremented).
This means almost every cache line containing Python objects - including
functions, modules... - has to be written back when it is evicted, even
if those objects are "constant".
> * Delayed reference counting (save 10 or 20 INCREF/DECREF ops to a
> buffer, then flush them all at once). In theory, it would retain the
> cache locality while amortizing locking needed for SMP machines.
You would have to lock the buffer, wouldn't you?
Unless you use per-CPU buffers.
More information about the Python-3000
mailing list