On Tue, 3 Sep 2024 15:24:02 GMT, Shaojin Wen <s...@openjdk.org> wrote:
>> Use fast path for ascii characters 1 to 127 to improve the performance of >> writing Utf8Entry to BufferWriter. > > Shaojin Wen has updated the pull request incrementally with two additional > commits since the last revision: > > - suggestion from @cl4es > - Revert "countGreaterThanZero -> CountNonNegatives" > > This reverts commit 431f55b46daf86fe9f2e24a2587eba8f65d847ff. Tests show that in intermediate mode and C1, the performance of `utf8_3_bytes` and `emoji` charType has regressed ## 1. -Xint ### 1.1 Script git remote add wenshao g...@github.com:wenshao/jdk.git git fetch wenshao # baseline git checkout 5d2e88fd9d808ec636b3dc7eb3e642ee864b1655 make test TEST="micro:java.lang.classfile.Utf8EntryWriteTo" MICRO="VM_OPTIONS=-Xint" # current git checkout c0e425cd5d711d225d98ed3cd966f4a96caea7ab make test TEST="micro:java.lang.classfile.Utf8EntryWriteTo" MICRO="VM_OPTIONS=-Xint" ### 1.2 MacBook M1 Pro Performance Numbers -# baseline -Benchmark (charType) Mode Cnt Score Error Units -Utf8EntryWriteTo.writeTo ascii avgt 9 1512116.497 ? 5557.804 ns/op -Utf8EntryWriteTo.writeTo utf8_2_bytes avgt 9 1583141.289 ? 4445.117 ns/op -Utf8EntryWriteTo.writeTo utf8_3_bytes avgt 9 2199600.958 ? 12867.974 ns/op -Utf8EntryWriteTo.writeTo emoji avgt 9 2273588.004 ? 6239.290 ns/op +# current +Benchmark (charType) Mode Cnt Score Error Units +Utf8EntryWriteTo.writeTo ascii avgt 9 179355.324 ? 570.346 ns/op +Utf8EntryWriteTo.writeTo utf8_2_bytes avgt 9 222915.457 ? 521.956 ns/op +Utf8EntryWriteTo.writeTo utf8_3_bytes avgt 9 3090322.657 ? 7896.473 ns/op +Utf8EntryWriteTo.writeTo emoji avgt 9 3142324.984 ? 10690.461 ns/op | | pattern | baseline | current | delta | | --- | --- | --- | --- | --- | | Utf8EntryWriteTo.writeTo | ascii | 1512116.497 | 179355.324 | 743.08% | | Utf8EntryWriteTo.writeTo | utf8_2_bytes | 1583141.289 | 222915.457 | 610.20% | | Utf8EntryWriteTo.writeTo | utf8_3_bytes | 2199600.958 | 3090322.657 | -28.82% | | Utf8EntryWriteTo.writeTo | emoji | 2273588.004 | 3142324.984 | -27.65% | ## 2. TieredStopAtLevel=1 ### 2.1 Script git remote add wenshao g...@github.com:wenshao/jdk.git git fetch wenshao # baseline git checkout 5d2e88fd9d808ec636b3dc7eb3e642ee864b1655 make test TEST="micro:java.lang.classfile.Utf8EntryWriteTo" MICRO="VM_OPTIONS=-Xint -XX:TieredStopAtLevel=1" # current git checkout c0e425cd5d711d225d98ed3cd966f4a96caea7ab make test TEST="micro:java.lang.classfile.Utf8EntryWriteTo" MICRO="VM_OPTIONS=-Xint -XX:TieredStopAtLevel=1" ### 2.2 MacBook M1 Pro Performance Numbers -# baseline -Benchmark (charType) Mode Cnt Score Error Units -Utf8EntryWriteTo.writeTo ascii avgt 9 23465.291 ? 136.422 ns/op -Utf8EntryWriteTo.writeTo utf8_2_bytes avgt 9 24892.661 ? 90.412 ns/op -Utf8EntryWriteTo.writeTo utf8_3_bytes avgt 9 24555.321 ? 96.907 ns/op -Utf8EntryWriteTo.writeTo emoji avgt 9 25322.357 ? 145.033 ns/op +# current +Benchmark (charType) Mode Cnt Score Error Units +Utf8EntryWriteTo.writeTo ascii avgt 9 9309.663 ? 122.261 ns/op +Utf8EntryWriteTo.writeTo utf8_2_bytes avgt 9 10037.304 ? 61.700 ns/op +Utf8EntryWriteTo.writeTo utf8_3_bytes avgt 9 31145.324 ? 168.506 ns/op +Utf8EntryWriteTo.writeTo emoji avgt 9 31804.202 ? 66.719 ns/op | | charType | baseline | current | delta | | --- | --- | --- | --- | --- | | Utf8EntryWriteTo.writeTo | ascii | 23465.291 | 9309.663 | 152.05% | | Utf8EntryWriteTo.writeTo | utf8_2_bytes | 24892.661 | 10037.304 | 148.00% | | Utf8EntryWriteTo.writeTo | utf8_3_bytes | 24555.321 | 31145.324 | -21.16% | | Utf8EntryWriteTo.writeTo | emoji | 25322.357 | 31804.202 | -20.38% | ## 3. Non-JVM Options ### 3.1 Script git remote add wenshao g...@github.com:wenshao/jdk.git git fetch wenshao # baseline git checkout 5d2e88fd9d808ec636b3dc7eb3e642ee864b1655 make test TEST="micro:java.lang.classfile.Utf8EntryWriteTo" # current git checkout c0e425cd5d711d225d98ed3cd966f4a96caea7ab make test TEST="micro:java.lang.classfile.Utf8EntryWriteTo" ### 3.2 MacBook M1 Pro Performance Numbers -# baseline -Benchmark (charType) Mode Cnt Score Error Units -Utf8EntryWriteTo.writeTo ascii avgt 9 15179.059 ? 152.360 ns/op -Utf8EntryWriteTo.writeTo utf8_2_bytes avgt 9 16189.050 ? 70.459 ns/op -Utf8EntryWriteTo.writeTo utf8_3_bytes avgt 9 15974.934 ? 61.737 ns/op -Utf8EntryWriteTo.writeTo emoji avgt 9 16549.691 ? 119.606 ns/op +# current +Benchmark (charType) Mode Cnt Score Error Units +Utf8EntryWriteTo.writeTo ascii avgt 9 4243.038 ? 86.923 ns/op +Utf8EntryWriteTo.writeTo utf8_2_bytes avgt 9 5050.839 ? 24.070 ns/op +Utf8EntryWriteTo.writeTo utf8_3_bytes avgt 9 13142.966 ? 164.620 ns/op +Utf8EntryWriteTo.writeTo emoji avgt 9 13483.680 ? 244.955 ns/op | | charType | baseline | current | delta | | --- | --- | --- | --- | --- | | Utf8EntryWriteTo.writeTo | ascii | 15179.059 | 4243.038 | 257.74% | | Utf8EntryWriteTo.writeTo | utf8_2_bytes | 16189.050 | 5050.839 | 220.52% | | Utf8EntryWriteTo.writeTo | utf8_3_bytes | 15974.934 | 13142.966 | 21.55% | | Utf8EntryWriteTo.writeTo | emoji | 16549.691 | 13483.680 | 22.74% | ------------- PR Comment: https://git.openjdk.org/jdk/pull/20772#issuecomment-2326859712