RFR: 8297561: Redundant index check in String.offsetByCodePoints() [v2]
Claes Redestad
redestad at openjdk.org
Wed Nov 30 20:47:18 UTC 2022
On Wed, 30 Nov 2022 18:17:47 GMT, Sergey Tsypanov <stsypanov at openjdk.org> wrote:
>> `String.offsetByCodePoints()` delegates to `Character.offsetByCodePoints()` which in turn specifies the same exception thrown under the same conditions and the implementation does exactly the same checks. This means we can remove the check from `String.offsetByCodePoints()` and rely on the one of `Character.offsetByCodePoints()`.
>
> Sergey Tsypanov has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>
> - Merge branch 'master' into JDK-8297561
> - 8297561: Add benchmark
> - 8297561: Redundant index check in String.offsetByCodePoints()
Changes requested by redestad (Reviewer).
test/micro/org/openjdk/bench/java/lang/StringOffsetByCodePoints.java line 1:
> 1: package org.openjdk.bench.java.lang;
Missing copyright header
test/micro/org/openjdk/bench/java/lang/StringOffsetByCodePoints.java line 9:
> 7: @BenchmarkMode(Mode.AverageTime)
> 8: @OutputTimeUnit(TimeUnit.NANOSECONDS)
> 9: @Warmup(iterations = 10, time = 1000, timeUnit = TimeUnit.MILLISECONDS)
For non-allocating microbenchmarks we usually get by with about 5 iterations of 1 second and same for warmup to produce stable results. Keeping runtime low ensures we can keep adding coverage to more APIs without incurring undue overhead
-------------
PR: https://git.openjdk.org/jdk/pull/11350
More information about the core-libs-dev
mailing list