HashBits, a lazy way

Stephen Pair stephen at pairhome.net
Thu Jul 10 12:53:37 UTC 2003


John M McIntosh wrote:

> You know since I'm tinkering with the VM, one of the pending ideas  
> which David Simmons talked to me oh
>  a few years back, plus some other VM folks was the issue of that 
> silly  object identity hash.
>
> Now it seems in doing these benchmarks there sits the code building  
> hash right up there in the
> usage numbers.
>
> The solution of course is to do it with lazy initialization, only 
> when  someone actually needs to use it do we
> build the hash number just for them.
>
> Right now I'm digging about to see what up, alas ObjectMemory has 
> class  constants for the bit range,
> but it also has this code below which uses the magic number of 17 
> (that  I will correct.
>
> So I'm having to be extra careful.
> Certainly if anyone has some warnings... Let me know.
>
> hashBitsOf: oop
>
>     ^ ((self baseHeader: oop) >> 17) bitAnd: 16rFFF


Seems like a fantastic idea...I can't wait to see what impact this might 
have on performance.

- Stephen



More information about the Squeak-dev mailing list