[Python-Dev] PyBench DictCreation (was Re: Performance compares)
Fri, 18 May 2001 09:26:36 +0200
Jeremy Hylton wrote:
> >>>>> "TP" == Tim Peters <email@example.com> writes:
> TP> I've got no interest in trying to restore the old behavior. A
> TP> compromise may be to boost the minimum size of a non-empty dict
> TP> from 4 to 8. As is, the only non-empty dicts that can get away
> TP> with using the current minimum size of 4 have no more than 2
> TP> elements. The question is whether such tiny non-empty dicts are
> TP> common enough to make everyone else pay for "an extra" resize.
> I also did a profile run on CreateInstances, which has a difference of
> +55.54% on my machine. It's basically the same story. The instance
> dictionary is getting resized more often with Python 2.1+ than it did
> with Python 1.5.2. I wouldn't be surprised if several more tests are
> showing a slowdown with the same cause.
> So boosting the minimum size sounds like a good thing.
FYI, I have a patch which inlines small dictionaries directly
into the type object (rather than usin malloc to allocate
the slot buffer).
I've experimented with the minimal size a lot and found that
setting it to 8 slots gives the bext performance/memory tradeoff.
CEO eGenix.com Software GmbH
Company & Consulting: http://www.egenix.com/
Python Software: http://www.lemburg.com/python/