[Python-Dev] PyBench DictCreation (was Re: Performance compares)

Guido van Rossum guido@digicool.com
Fri, 18 May 2001 10:05:45 -0500


> [MAL]
> > FYI, I have a patch which inlines small dictionaries directly
> > into the type object
> 
> You don't mean that, but how about uploading the patch to SF anyway?  Assign
> it to me and I'll dig into it.

(I guess he means the buffer is alloc'ed contiguously with the dict
object head.  That's often a nice strategy.  Could do that for small
lists too maybe, except those haven't gotten anybody's attention just
yet.)

> > ...
> > I've experimented with the minimal size a lot and found that
> > setting it to 8 slots gives the bext performance/memory tradeoff.
> 
> Having done just a couple rounds of instrumented runs across various apps, I
> was moving to that conclusion too.  Also that "small" dicts are so common
> that avoiding the "extra" malloc would be a nice win for them, and that large
> dicts are rare enough and resizing expensive enough anyway that the new cost
> of doing a two-headed allocation strategy would be lost in the noise.  IOW,
> I'm inclined to believe that everything you say your patch does is Good For
> Python, and Guido is so sympathetic to my lack of sleep lately that I bet
> he'll let me slip in one uglification without scowling <wink>.

Yeah, this one sounds like a nice improvement.

--Guido van Rossum (home page: http://www.python.org/~guido/)