String hashCode

Tom Tromey tromey@redhat.com
Wed Jan 31 17:01:00 GMT 2001


>>>>> "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


More information about the Java mailing list

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