[Python-Dev] Activating pymalloc

Tim Peters tim.one@comcast.net
Fri, 15 Mar 2002 18:28:28 -0500


>> I've said several times that I intend to boost it.

[Neil Schemenauer]
> Got a number in mind?

I hate to disappoint Jeremy, but 1582 is too large -- the limit with the
code as currently written is 256.  It's 64 now on my box, which is the only
one that matters to me <wink>.

sizeof(struct _dictobject) is up to 124 now on my box.  Add 12 bytes for GC
overhead and it's 136, which, conveniently enough, is a multiple of 8
(another constraint).  I think it's important that pymalloc be able to field
"small dict" requests on its own.  So 136 is the first boost I'd try, and
then 144 when the debugger shows me dicts still aren't getting handled
<wink>.  If we can adjust Unicode objects to get at this allocator for
string storage, that's enough too for a 68-character string, which is more
likely to hit more often than a 64 / 2 = 32-character Unicode string limit.
People who actually use Unicode may wish to argue for a larger limit.

I haven't identified any frightening downside to letting pymalloc run all
the way to 256, except that it's going to consume 4K if there's a single
object of any given multiple-of-8 size.  BFD.  So, unless Vladimir knows of
a killer reason not to, I'd be happy to give

#define SMALL_REQUEST_THRESHOLD 256

a whack; i.e., max it out.  Typical RAM capacity is much larger now than
when this code was first written, so I'm certainly not worried about the
size of the static usedpools vector (which needs space proportional to the
number of distinct size classes pymalloc handles on its own).