Python's garbage collection was Re: Python reliability

Paul Rubin http
Thu Oct 13 11:24:41 EDT 2005


Scott David Daniels <scott.daniels at acm.org> writes:
> Current speeds are due to deep pipelines, and a conditional in the
> INCREF code would blow a pipeline.

I think most of the time, branch prediction will prevent the cache
flush.  Anyway, with consed integers, there's still going to be a
conditional or even a dispatch on the tag field.  Finally, when you
know you're dealing with small integers, you don't need to even check
the tags.  Some implementations use the low order bits as tags with a
tag==0 meaning an integer.  That means if you have two tagged integers,
you can add and subtract them without having to twiddle the tags.

The alternative (tag==1 means integer) means you don't have to mask
off the tag bits to dereference pointers, and you can still add a
constant to a tagged int by simply adjusting the constant
appropriately.  E.g., with one tag bit, to increment you'd add 2 to
the tagged int.



More information about the Python-list mailing list