RFR: 8254807: Optimize startsWith() for String.substring()
Xin Liu
xliu at openjdk.java.net
Sun Nov 1 21:13:56 UTC 2020
On Sat, 31 Oct 2020 14:44:05 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> The optimization transforms code from s=substring(base, beg, end); s.startsWith(prefix)
>> to substring(base, beg, end) | base.startsWith(prefix, beg).
>>
>> it reduces uses of substring. hopefully c2 optimizer can remove the used substring.
>
> test/micro/org/openjdk/bench/vm/compiler/SubstringAndStartsWith.java line 44:
>
>> 42: @Measurement(iterations = 20, time = 200, timeUnit = TimeUnit.MILLISECONDS)
>> 43: @State(Scope.Benchmark)
>> 44: public class SubstringAndStartsWith {
>
> I'd put this micro in org.openjdk.bench.java.lang and call it SubstringStartsWith
got it.
-------------
PR: https://git.openjdk.java.net/jdk/pull/974
More information about the hotspot-compiler-dev
mailing list