On Thu, 24 Nov 2022 10:08:31 GMT, Sergey Tsypanov <stsypa...@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()`. I've added a benchmark for the changes, on my machine it gives the following results: baseline Benchmark Mode Cnt Score Error Units StringOffsetByCodePoints.offsetByCodePoints avgt 30 6.616 ± 0.040 ns/op patch Benchmark Mode Cnt Score Error Units StringOffsetByCodePoints.offsetByCodePoints avgt 30 6.606 ± 0.008 ns/op ------------- PR: https://git.openjdk.org/jdk/pull/11350