RFR: 8299807: String.newStringUTF8NoRepl and getBytesUTF8NoRepl always copy arrays
Glavo
duke at openjdk.org
Wed Jan 11 16:03:13 UTC 2023
On Mon, 9 Jan 2023 03:34:55 GMT, Glavo <duke at openjdk.org> wrote:
> `JavaLangAccess::newStringUTF8NoRepl` and `JavaLangAccess::getBytesUTF8NoRepl` are not implemented correctly. They always copy arrays, rather than avoiding copying as much as possible as javadoc says.
>
> I ran the tier1 test without any new errors.
I noticed that the baseline had a high variance in the above test results, so I added the warm-up and running time to retest.
Here are the new results:
baseline:
Benchmark (length) Mode Cnt Score Error Units
NoRepl.testReadAscii 0 avgt 5 209.602 ± 2.982 ns/op
NoRepl.testReadAscii 1024 avgt 5 291.026 ± 0.266 ns/op
NoRepl.testReadAscii 8192 avgt 5 416.418 ± 1.083 ns/op
NoRepl.testReadAscii 1048576 avgt 5 29678.103 ± 119.644 ns/op
NoRepl.testReadAscii 33554432 avgt 5 1136507.598 ± 2597.706 ns/op
NoRepl.testReadUTF8 0 avgt 5 205.729 ± 1.229 ns/op
NoRepl.testReadUTF8 1024 avgt 5 1295.330 ± 4.092 ns/op
NoRepl.testReadUTF8 8192 avgt 5 9352.954 ± 126.249 ns/op
NoRepl.testReadUTF8 1048576 avgt 5 1202516.789 ± 2876.660 ns/op
NoRepl.testReadUTF8 33554432 avgt 5 44475835.218 ± 80173.497 ns/op
This PR:
Benchmark (length) Mode Cnt Score Error Units
NoRepl.testReadAscii 0 avgt 5 212.301 ± 1.002 ns/op
NoRepl.testReadAscii 1024 avgt 5 284.751 ± 1.685 ns/op
NoRepl.testReadAscii 8192 avgt 5 353.243 ± 2.501 ns/op
NoRepl.testReadAscii 1048576 avgt 5 19740.869 ± 137.207 ns/op
NoRepl.testReadAscii 33554432 avgt 5 853450.226 ± 7765.001 ns/op
NoRepl.testReadUTF8 0 avgt 5 200.015 ± 3.930 ns/op
NoRepl.testReadUTF8 1024 avgt 5 1281.397 ± 16.402 ns/op
NoRepl.testReadUTF8 8192 avgt 5 9333.988 ± 9.603 ns/op
NoRepl.testReadUTF8 1048576 avgt 5 1202822.719 ± 3187.910 ns/op
NoRepl.testReadUTF8 33554432 avgt 5 44579793.940 ± 106239.604 ns/op
The conclusion is basically unchanged.
-------------
PR: https://git.openjdk.org/jdk/pull/11897
More information about the core-libs-dev
mailing list