[Python-Dev] Dictionary tuning
Wed, 30 Apr 2003 13:30:22 -0400
> And I'm surprised if you read this far. Summary: i^=1 is not likely to
> win comapred to ++i, unless we increase dict size 33%.
Right! I had tried i^=1 and it had near zero or slightly negative
effects on performance. It resulted in more collisions, though
the collisions were resolved relatively cheaply.
I had also experimented with changing alignment, but nothing
helped. Everything is already word aligned and that takes
care of the HW issues. The only benefit to the alignment
is that i^=1 guarantees a cache hit. Without alignment, the
odds are 4 out of 5.3 will have a hit (since there a 5.3 entries
to a line).
Increasing the dict size 33% with unused space doesn't help
sparseness and negatively impacts the chance cache hits you
already have with smaller dictionaries.