On Wed, 7 Aug 2002, Eric Blake wrote:
In response to Hans answer, String.hashCode does not use
Object.hashCode, so the location of a String object in memory has no
effect on whether hashing would be useful. Thus, if gcj does merge with
classpath, all String objects would become at least 4 bytes larger to
store the cache. Tom, that may be something for you to consider when
you ever do get around to looking at my patch.
I did some benchmarking with the cachedHashCode bits of your patch.
Interestingly, it helped considerably on my interpreter benchmarks,
chopping about 15% off total run time.
Thanks for benchmarking this. It looks like this is a clear win to me.
Given that its also what the JDK appears to do, I think we should go
ahead and change String to cache the hashCode.