[FIX] Re: [FIX] identityHash and fixing collections. (repost)

Scott A Crosby crosby at qwes.math.cmu.edu
Mon Dec 10 00:18:52 UTC 2001


*sigh* I just realized that I never checked 4097 for primeness. Its not
prime.  $p=4099$ is prime. A larger number is wiser to avoid the chance
that the array becomes an exact multiple of $p$, but will cause problems
if hashBits is ever increased. If there is no expectation to change
hashBits, then $p=135859$ is a better choice.)

Scott



On Sun, 9 Dec 2001, Scott A Crosby wrote:

> Hello. I started a thread a few months ago about horrible unscalability in
> the collections. Specifically, Set, Dictionary, etc would become extremely
> inefficient in nasty ways if you attempted to store more than about 3000
> objects in them. I've fixed this.
>
> This unscalability doesn't happen in the typical image, but applications
> that do try to store a lot (>3000) of items in sets/dictionaries may
> encounter this problem. For dictionaries/sets with >3000 items this patch
> will speed them up by 100-1000x.
>
> The trick is to refactor identityHash into a hashBits function and a
> identityHash, then rebuild all of the sets.
>
> I've done that.
>
> Note, IdentityHash4.1.cs may be UNSAFE to apply if you have any
> identitySet or identityDictionary using an array with more than 4000
> elements. In the normal image, this is not a problem. (This is because
> Identity*>>scansFor: has special case code for larger those larger
> arrays.)
>
> The other nit, is that if you attempt to build a set/dictionary with over
> 12 million items, the same sort of unscalability may occur again. I don't
> see this being a problem at the current time. :)
>
> Anyways, file these in, IN ORDER, and wait for the rehashing (which takes
> about 10 minutes). Also, this code does do deep things to the underlying
> infrastructure of your image.... So use a duplicate of your image.
>
> After this is filed in, there's quite a bit of refactoring that can be
> done with {"",Weak,Identity,Pluggable}{Set,Dictionary}.
>
> Scott
>
>
> --
> No DVD movie will ever enter the public domain, nor will any CD. The last CD
> and the last DVD will have moldered away decades before they leave copyright.
> This is not encouraging the creation of knowledge in the public domain.
>
>
>

--
No DVD movie will ever enter the public domain, nor will any CD. The last CD
and the last DVD will have moldered away decades before they leave copyright.
This is not encouraging the creation of knowledge in the public domain.





More information about the Squeak-dev mailing list