Python's garbage collection was Re: Python reliability

Scott David Daniels scott.daniels at
Thu Oct 13 17:14:29 CEST 2005

Paul Rubin wrote:
> "Diez B. Roggisch" <deets at> writes:
    (about tag bits)
 >>... Basically I think that trying to come up with all sorts of
 >> optimizations for rather marginal problems (number crunching
 >> should be - if a python domain at all - done using Numarray)
> I don't think it's necessarily marginal.  Tagged ints can be kept in
> registers, which means that even the simplest code that does stuff
> with small integers becomes a lot more streamlined, easing the load on
> both the Python GC and the cpu's memory cache....
But the cost on modern computers is more problematic to characterize.
Current speeds are due to deep pipelines, and a conditional in the
INCREF code would blow a pipeline.  On machines with a conditional
increment instruction (and a C (or whatever) compiler clever enough to
use it, saving the write saves dirty cache in the CPU, but most of
today's CPU/compiler combos will flush the pipeline, killing a number
of pending instructions.

> Right now with the bytecode interpreter, it probably doesn't matter,
> but with Pypy generating native machine code, this kind of thing can
> make a real difference.
You are right that Pypy is the place to experiment with all of this.
That project holds a lot of promise for answering questions that seem
to otherwise degenerate into "Jane, you ignorant slut" (for non-US
readers, this is a reference to an old "Saturday Night Live" debate
skit where the debate always degenerated into name-calling).

--Scott David Daniels
scott.daniels at

More information about the Python-list mailing list