string hash performance

Bryce McKinlay bryce@waitaki.otago.ac.nz
Sun Aug 18 22:37:00 GMT 2002


Jeff Sturm wrote:
>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.
regards
Bryce.


More information about the Java mailing list

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