RFR: 8278518: String(byte[], int, int, Charset) constructor and String.translateEscapes() miss bounds check elimination [v3]
Roland Westrelin
roland at openjdk.java.net
Thu Jan 13 10:24:19 UTC 2022
On Thu, 13 Jan 2022 10:19:51 GMT, Roland Westrelin <roland at openjdk.org> wrote:
>> @rwestrel The benchmark is mine and OCA is signed. Here's the code
>>
>> @State(Scope.Thread)
>> @BenchmarkMode(Mode.AverageTime)
>> @OutputTimeUnit(TimeUnit.NANOSECONDS)
>> public class StringConstructorBenchmark {
>> private byte[] array;
>> private String str;
>>
>> @Setup
>> public void setup() {
>> str = "Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen. Я";//Latin1 ending with Russian
>> array = str.getBytes(StandardCharsets.UTF_8);
>> }
>>
>> @Benchmark
>> public String newString() {
>> return new String(array, 0, array.length, StandardCharsets.UTF_8);
>> }
>>
>> @Benchmark
>> public String translateEscapes() {
>> return str.translateEscapes();
>> }
>> }
>
>> Thank you, @stsypanov for clarifying status of your benchmark. @amirhadadi I agree that to have simple benchmark is good. But I also want to add Sergey's benchmark because it shows the issue in this bug description. I suggest to add both benchmarks.
>
> Ok. I pushed a new change with Sergey's benchmark and a new one I wrote.
> @rwestrel The benchmark is mine and OCA is signed. Here's the code
I added the benchmark. What copyright do you want on it?
-------------
PR: https://git.openjdk.java.net/jdk/pull/7034
More information about the hotspot-compiler-dev
mailing list