Am 26.02.2010 20:32, schrieb Alan Bateman:
Ulf Zibis wrote:
For these other suggestions it would be great to create
micro-benchmarks and try our your changes.
For now though, as I said, I'm just fixing the method to avoid the
store for the empty string case.
Here the benchmark for my different approaches on non-empty strings:
hashCode() warmup = 38,227 ms
hashCode1() warmup = 323,462 ms
hashCode() time = 12,066 ms
hashCode1() time = 11,620 ms
hashCodes sum = 0
hashCode() warmup = 34,928 ms
hashCode1() warmup = 19,010 ms
hashCode2() warmup = 25,938 ms
hashCode3() warmup = 22,428 ms
hashCode4() warmup = 22,966 ms
hashCode5() warmup = 21,372 ms
hashCode() time = 418,962 ms
hashCode1() time = 306,977 ms
hashCode2() time = 296,899 ms
hashCode3() time = 363,364 ms
hashCode4() time = 286,098 ms
hashCode5() time = 269,519 ms
hashCodes sum = -1427881024
See new revision:
https://java-nio-charset-enhanced.dev.java.net/source/browse/java-nio-charset-enhanced/branches/j7_EUC_TW/src/java/lang/String.java?rev=955&view=markup
-Ulf