Python's biggest compromises

Brian Quinlan brian at sweetapp.com
Sat Aug 2 01:41:38 EDT 2003


> In a fast GC system you would just allocate the floats from a 
> contiguous block.  

This is how Python works now.

> Later you would copy the reachable floats from that block to another
> block.  If no floats are reachable, you don't copy anything.  

Is determining if a float is reachable faster or slower than
dereferencing a pointer and comparing an integer to zero? 'cause that is
all reference counting requires.

I'm not saying that the reference counting (+ something else) is the
optimal GC strategy for Python but it seems to have advantages when
working with a lot of objects with short lifetimes.

> Does checking to see if a There are all kinds of optimizations you 
> can use, including making clever use of memory protection hardware 
> to notice when your  allocator has run over the end of a block so 
> you don't have to even  make an explicit pointer comparison, that 
> can make all this run very fast.

Of course the PythonLabs implementation can never require such a trick.

Cheers,
Brian 






More information about the Python-list mailing list