RFR: 8336831: Optimize StringConcatHelper.simpleConcat [v5]

Shaojin Wen duke at openjdk.org
Fri Jul 19 21:48:49 UTC 2024


On Fri, 19 Jul 2024 21:42:09 GMT, Shaojin Wen <duke at openjdk.org> wrote:

>> Currently simpleConcat is implemented using mix and prepend, but in this simple scenario, it can be implemented in a simpler way and can improve performance.
>
> Shaojin Wen has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Update src/java.base/share/classes/java/lang/String.java
>    
>    Co-authored-by: Chen Liang <liach at openjdk.org>
>  - add comments

Below are the performance numbers of the latest version running on a MacBook M1 Pro, which is 9.19% faster

-Benchmark                             (intValue)  Mode  Cnt  Score   Error  Units (base c25c4896ad9ef031e3cddec493aef66ff87c48a7)
-StringConcat.concatMethodConstString        4711  avgt   15  5.440 ? 0.075  ns/op

+Benchmark                             (intValue)  Mode  Cnt  Score   Error  Units (current 69901157e4dae9018abd727956f60fd11b8fa252)
+StringConcat.concatMethodConstString        4711  avgt   15  4.982 ? 0.019  ns/op +9.19%

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20253#issuecomment-2240251072


More information about the core-libs-dev mailing list