This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: compacting _Jv_Utf8Const
- From: Chris Gray <chris dot gray at kiffer dot be>
- To: Per Bothner <per at bothner dot com>, java at gcc dot gnu dot org
- Date: Thu, 6 May 2004 00:37:28 +0200
- Subject: Re: compacting _Jv_Utf8Const
- References: <40993F2A.2060408@bothner.com>
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