|
In a message dated 11/6/2004 3:48:49 PM Eastern Standard Time, [EMAIL PROTECTED] writes:
In the Java code I am looking at these days (JMX for example) I am one would think, but it might depend on how the underlying code is written. When a string object is created--if I were writing the object--it'd do some kind of check sum with xor or something like that to offer some kind of numeric identity for the string which would make string compare as fast as int compare because it would be an int compare.
I do a ton of string compares in my code and they seem to go very quickly. Might be fun to write a benchmark to compare the time it takes to compare a hundred million pregenerated random integers as opposed to a hundred million compares of pregenerated strings of one character, two characters, three characters, and so on. If the java guys did what I would have done, the compares might differ a bit between ints and strings, but shouldn't vary according to the length of the strings. If the compare gets slower according to the length of the string, bad on java guys.
is it more fun figuring it out by testing it or by going into the java code and reading how they actually did it? We could do a spinal tap before and after each and measure the relative amounts of serotonin ...
|
_______________________________________________ Juglist mailing list [EMAIL PROTECTED] http://trijug.org/mailman/listinfo/juglist_trijug.org
