HashBits, a lazy way
John M McIntosh
johnmci at mac.com
Wed Jul 9 04:38:22 UTC 2003
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
--
========================================================================
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
========================================================================
===
More information about the Squeak-dev
mailing list
|