This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: string hash performance


On Wed, 7 Aug 2002, Eric Blake wrote:
> Classpath's implementation also caches the hashcode.  You can also
> verify, by reflection, that Sun's version of the JDK likewise does
> caching.

Interesting.  I also noticed in hprof output that Object instances are 4
bytes while Strings are 20 bytes.

> Thus, if gcj does merge with
> classpath, all String objects would become at least 4 bytes larger to
> store the cache.

It's hard to say if String is better off with or without.  At least
cachedHashCode need not be volatile or synchronized since any
loads/stores should be atomic.

My interpreter needs some large string tables.  I'll see about
benchmarking it with cachedHashCode.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]