Need reviewer for forward port of 6815768 (File.getXXXSpace) and 6815768 (String.hashCode)
Ulf Zibis
Ulf.Zibis at gmx.de
Sat Feb 27 21:03:52 UTC 2010
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.
I've added benchmark for "same" strings:
LONG.substring(1).<init> warmup = 6.170 ms
LONG.substring(1).hashCode() warmup = 80.545 ms
LONG.substring(1).hashCode1() warmup = 27.564 ms
LONG.substring(1).hashCode2() warmup = 103.577 ms
LONG.substring(1).hashCode3() warmup = 63.706 ms
LONG.substring(1).hashCode4() warmup = 83.302 ms
LONG.substring(1).hashCode5() warmup = 52.357 ms
LONG.substring(1).hashCode6() warmup = 86.450 ms
LONG.substring(1).<init> time = 101.919 ms
LONG.substring(1).hashCode() time = 931.121 ms
LONG.substring(1).hashCode1() time = 635.150 ms
LONG.substring(1).hashCode2() time = 563.309 ms
LONG.substring(1).hashCode3() time = 599.341 ms
LONG.substring(1).hashCode4() time = 581.050 ms
LONG.substring(1).hashCode5() time = 608.527 ms
LONG.substring(1).hashCode6() time = 542.390 ms
hashCodes sum = 1197450336
SAME1==SAME2<init> warmup = 98.305 ms
SAME1.equals(SAME2) warmup = 43.749 ms
SAME1.equals1(SAME2) warmup = 154.050 ms
SAME1.equals2(SAME2) warmup = 83.096 ms
SAME1.equals3(SAME2) warmup = 348.704 ms
SAME1.equals4(SAME2) warmup = 114.798 ms
SAME1.equals5(SAME2) warmup = 77.480 ms
SAME1==SAME2<init> time = 97.395 ms
SAME1.equals(SAME2) time = 120.363 ms
SAME1.equals1(SAME2) time = 271.393 ms
SAME1.equals2(SAME2) time = 131.297 ms
SAME1.equals3(SAME2) time = 539.923 ms
SAME1.equals4(SAME2) time = 175.093 ms
SAME1.equals5(SAME2) time = 159.624 ms
LONG1.equals(LONG2) warmup = 41.916 ms
LONG1.equals1(LONG2) warmup = 75.950 ms
LONG1.equals2(LONG2) warmup = 65.594 ms
LONG1.equals3(LONG2) warmup = 17.908 ms
LONG1.equals4(LONG2) warmup = 16.399 ms
LONG1.equals5(LONG2) warmup = 16.334 ms
LONG1.equals(LONG2) time = 67.612 ms
LONG1.equals1(LONG2) time = 124.927 ms
LONG1.equals2(LONG2) time = 142.572 ms
LONG1.equals3(LONG2) time = 35.580 ms
LONG1.equals4(LONG2) time = 30.342 ms
LONG1.equals5(LONG2) time = 23.478 ms
Do you have any idea, why equals1() is so much slower than equals() ??
I can't believe that the single compare 'if (n != 0)' raises the time so much.
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=960&view=markup
-Ulf
More information about the core-libs-dev
mailing list