On Fri, 18 Oct 2024 21:56:53 GMT, Shaojin Wen <s...@openjdk.org> wrote:
>> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two methods can be optimized by C2. > > Shaojin Wen has updated the pull request with a new target base due to a > merge or a rebase. The incremental webrev excludes the unrelated changes > brought in by the merge/rebase. The pull request contains 26 additional > commits since the last revision: > > - Merge remote-tracking branch 'origin/optim_str_builder_append_202406' into > optim_str_builder_append_202406 > - fix build error > - Merge remote-tracking branch 'upstream/master' into > optim_str_builder_append_202406 > - Merge remote-tracking branch 'upstream/master' into > optim_str_builder_append_202406 > - Merge remote-tracking branch 'origin/optim_str_builder_append_202406' into > optim_str_builder_append_202406 > - Merge remote-tracking branch 'upstream/master' into > optim_str_builder_append_202406 > - Merge remote-tracking branch 'upstream/master' into > optim_str_builder_append_202406 > - revert test > - Merge remote-tracking branch 'upstream/master' into > optim_str_builder_append_202406 > - Merge remote-tracking branch 'upstream/master' into > optim_str_builder_append_202406 > - ... and 16 more: https://git.openjdk.org/jdk/compare/d6725bc9...457735c9 Simplifying the implementation of appendNull can improve performance, but it is still not as good as using Unsafe.putByte. git remote add wenshao g...@github.com:wenshao/jdk.git git fetch wenshao # master git checkout 85582d7a88bd5f79f5991ce22bc3bc75e514aec9 make test TEST="micro:java.lang.StringBuilders.appendWithNull8Latin1" # pr 19970 git checkout 3b89956957085e134a05c05876f40b85d949227e make test TEST="micro:java.lang.StringBuilders.appendWithNull8Latin1" # pr 19970 + simplify append null git checkout a43be33a6cc67ac72058d1819ee3008fb6f76211 make test TEST="micro:java.lang.StringBuilders.appendWithNull8Latin1" # pr 19626 + 19970 git checkout 58dae7888eceb1c61243f658b67c208e6c30f7f2 make test TEST="micro:java.lang.StringBuilders.appendWithNull8Latin1" ## MacBook M1 Max Performance Numbers # master Benchmark Mode Cnt Score Error Units StringBuilders.appendWithNull8Latin1 avgt 15 6.950 ? 0.027 ns/op # pr 19970 Benchmark Mode Cnt Score Error Units StringBuilders.appendWithNull8Latin1 avgt 15 6.945 ? 0.008 ns/op # pr 19970 + simplify append null Benchmark Mode Cnt Score Error Units StringBuilders.appendWithNull8Latin1 avgt 15 6.766 ? 0.012 ns/op # pr 19626 + 19970 Benchmark Mode Cnt Score Error Units StringBuilders.appendWithNull8Latin1 avgt 15 6.441 ? 0.059 ns/op ------------- PR Comment: https://git.openjdk.org/jdk/pull/19626#issuecomment-2425269311