[Q] Dictionary delays

Harry Chesley chesley at network172.com
Fri Apr 12 15:10:34 UTC 2002


In the project I'm working on, I use several very large
IdentityDictionary's (on the order of a half million entries each). The
processing steps that fill them up start out taking about 1ms (timed
1000 at a time with Time millisecondsToRun:) but as things fill, the
time increases to about 10ms in the end. I thought I could speed things
up by allocating large dictionaries to start with (IdentityDictionary
new: 500000 rather than just IdentityDictionary new). But instead, it
slowed things down, with processing steps now starting out taking 4ms,
and still increasing over time.

This seems to imply that the dictionary is getting copied. I had thought
that dictionaries only got copied when they needed to expand, which
shouldn't be happening with the larger initial size. Or during the
garbage collection process, which I didn't think it would be a recurring
or at least frequent thing.

Does anyone understand why I'm getting the behavior I am? And more
importantly, if there's any way to speed things up? Besides the question
of the dictionary size increase not helping, I'm not sure I understand
why my processing steps slow down over time. I would expect some slow
down as the dictionary becomes denser, but I'm not sure a factor of ten
is reasonable, though some of it could be due to my program, not the
dictionary.

Thanks.






More information about the Squeak-dev mailing list