RFR: 8254782: Fix benchmark issues in java/lang/StringIndexOfChar.java benchmark
Claes Redestad
redestad at openjdk.java.net
Wed Oct 28 22:52:49 UTC 2020
On Wed, 28 Oct 2020 21:59:53 GMT, Jason Tatton <github.com+70893615+jasontatton-aws at openjdk.org> wrote:
> Please review the improvements which I have made to the java/lang/StringIndexOfChar.java jmh benchmark. Please let me know if any further improvements are required.
>
> Thanks,
> Jason
Looks OK.
FWIW the current looping scheme look like what the [SafeLooping.measureWrong_2](https://github.com/openjdk/jmh/blob/620036ec27db3503fa2dee476036b3219c9a38bc/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_34_SafeLooping.java#L115) warns us about, and could possibly be improved by taking cues from [SafeLooping.measureRight_1](https://github.com/openjdk/jmh/blob/620036ec27db3503fa2dee476036b3219c9a38bc/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_34_SafeLooping.java#L136) and sink each `what.indexOf(..)` into a `BlackHole`. This might matter here since each unit of work is quite small.
I'll approve the patch as-is, but please consider making those changes.
test/micro/org/openjdk/bench/java/lang/StringIndexOfChar.java line 63:
> 61: private String [] utf16_sse4;
> 62: private String [] utf16_avx2;
> 63: private String [] utf16_mixedLength;
I'd be a little bit happier with `String[]` rather than `String []`
-------------
Marked as reviewed by redestad (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/918
More information about the core-libs-dev
mailing list