Andrew MacIntyre wrote:
> I tried a LIFO stack implementation (though I won't claim to have done it
> well), and found it slightly slower than no freelist at all. The
> advantage of such an approach is that the known size of the stack makes
> deallocating excess objects easy (and thus no need for
> sys.compact_free_list() ).

I've tried a single linked free list myself. I used the ob_type field to
daisy chain the int and float objects. Although the code was fairly
short it was slightly slower than an attempt without a free list at all.
pymalloc is fast. It's very hard to beat it though.

A fixed size LIFO array like PyFloatObject
*free_list[PyFloat_MAXFREELIST] increased the speed slightly. IMHO a
value of about 80-200 floats and ints is realistic for most apps. More
objects in the free lists could keep too many pymalloced areas occupied.

Christian

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to