1 Dec 02:45
Re: Hash changes
Andreas Raab <andreas.raab <at> gmx.de>
2009-12-01 01:45:27 GMT
2009-12-01 01:45:27 GMT
Thanks. Now I see what's happening. The problem is that adding objects without scaled hash to a "regular" Dictionary creates hugely disproportional collision chain(s) as soon as we get north of 4096 objects. At this point all the possible entries that any new object could have by default are already taken and since we use a linear collision chain they combine into one gigantonormeous (hope I spelled that correctly(Continue reading)collision chain. That explains the difference - for larger number of elements we end up (with your changes) with an average length of the collision chain being (dict size // 4096) for both adding and accessing where without the scale we end up with a collision chain of (dict size) length (for adding) and (dict size // 2) for accessing elements once all possible initial slots are filled up and spill over. (and we should probably add a comment explaining the issue) Cheers, - Andreas Levente Uzonyi wrote: > On Mon, 30 Nov 2009, Andreas Raab wrote: > >>> | test array | >>> Transcript open; cr. >>> test := Dictionary new. >> >> "There used to be an old issue with growth of Sets that were initially >> sized with goodSizeFor: 3. Try working around it by starting at 5." >> test := Dictionary new: 5.
collision chain.
That explains the difference - for larger number of elements we end up
(with your changes) with an average length of the collision chain being
(dict size // 4096) for both adding and accessing where without the
scale we end up with a collision chain of (dict size) length (for
adding) and (dict size // 2) for accessing elements once all possible
initial slots are filled up and spill over.
(and we should probably add a comment explaining the issue)
Cheers,
- Andreas
Levente Uzonyi wrote:
> On Mon, 30 Nov 2009, Andreas Raab wrote:
>
>>> | test array |
>>> Transcript open; cr.
>>> test := Dictionary new.
>>
>> "There used to be an old issue with growth of Sets that were initially
>> sized with goodSizeFor: 3. Try working around it by starting at 5."
>> test := Dictionary new: 5.
Cheers,
- Andreas
> Collections-ul.217 "Initialization"
> Kernel-ul.312 "Object >> #hash"
> Kernel-ul.313
> Kernel-ul.314
> Collections-ul.228 "IdentityDictionary"
> Collections-ul.229
> Collections-ul.230 "KeyedIdentitySet"
> Collections-ul.231
> Collections-ul.232 "WeakIdentityKeyDictionary"
> Collections-ul.233
> Collections-ul.234 "IdentitySet"
> Collections-ul.235
> System-ul.185 "SystemDictionary"
> System-ul.186
> System-ul.187
> Collections-ul.236 "Cleanup"
> Collections-ul.237
>
RSS Feed