compacting _Jv_Utf8Const

Chris Gray chris.gray@kiffer.be
Wed May 5 22:33:00 GMT 2004


On Wednesday 05 May 2004 21:23, Per Bothner wrote:
> _Jv_Utf8Const names take up a fair amount of space. (However, I don't
> have numbers on this. Does anyone?) Some of it is "overhead": the
> length (2 bytes), hash code (2 bytes), final '0円' (1 byte), and
> alignment (0-1 bytes). How about this more compact encoding:
>> struct _Jv_Utf8Const
> {
> unsigned char hash;

With an 8-bit hashcode you will get so many collisions that you might as well 
not have one (so your hashtable degenerates into a list or tree). Just try 
dong the calculation "if I have N strings, what is the probabilty that two 
have the same hashcode " for N = 2, 3, 4... and you'll see what I mean.
-- 
Chris Gray /k/ Embedded Java Solutions
Embedded & Mobile Java, OSGi http://www.kiffer.be/k/
chris.gray@kiffer.be +32 3 216 0369


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /