[Python-Dev] pymalloc killer

Tim Peters tim.one@comcast.net
Fri, 29 Mar 2002 13:05:23 -0500


[Kevin Jacobs]
> Then make multiple thread-specific fingers, which will presumably
> result in higher hit rates due to better locality.

But at the cost of significantly slowing every test.  Python has no
efficient TLS abstraction:  we'd have to call get_thread_ident() every time,
then look up the finger in a dict devoted to this purpose.  All that is
likely as expensive as a binary search.

> To prevent fingers from being invalidated, do not remove arenas that
> are deallocated from the tree -- just mark them inactive.

That part's already done, except we save time by not bothering to mark them
inactive <wink>.  That is, pymalloc has never returned arenas to the system,
and still doesn't.

> ...
> Why not use a smaller (non-global) lock to protect arena modification
> and finger flushing?

I don't know what "finger flushing" means.  Note that Python has no
efficient x-platform lock abstraction either.

Note that every suggestion you dream up is competing with a gimmick that's
*very* fast now in typical cases.  If you can't picture the exact machine
instructions generated and hold them in your head all at once with ease,
it's probably too expensive to consider.