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]

Re: String hashCode


>>>>> "Bryce" == Bryce McKinlay <bryce@albatross.co.nz> writes:

Bryce> This would speed up String.equals() by being able to return
Bryce> false quickly in the common case, as well as speeding up things
Bryce> like Hashtables of Strings and string interning.

FYI I've been planning to change the data structure used for
String.intern.  I have a patch to do this already; I'll check it in
after the branch is made.

The new data structure is an STL map<> (a red-black tree).  I chose
this because it has better worst-case performance than the existing
hash table and is therefore better for real-time usage.  The hash
table is bad because rehashing makes the worst case expensive.

Anyway, the new data structure uses String.compareTo and not the hash
code.  So speeding it up won't help intern().

Tom

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