Python's biggest compromises

Brian Quinlan brian at sweetapp.com
Fri Aug 1 14:06:09 EDT 2003


> Reference counting spreads the speed hit over the entire program,
while
> other techniques tend to hit performance hard every so often.  But all
> together I think reference counting is usually slower than a good GC
> algorithm, and incremental garbage collection algorithms can avoid
> stalling.  And I'm sure that the current state -- references counting
> plus another kind of garbage collection for circular references --
must
> be worse than either alone. 

I'm not sure that I believe this. In Python, everything is an object
that participates in GC including integers and other light-weight types.
Imagine that you have a mathematic expression that creates a dozen
floats objects as part of its evaluation. Do you believe that it is
faster to add those dozen floats to a list for later collection than to
decrement an integer, notice that the decremented value is 0 and
immediately reclaim the memory? That would not be my intuition (but my
intuition is often wrong :-)).

Cheers,
Brian






More information about the Python-list mailing list