RFR: 8357823: Changes in StringBuilder (JDK-8351443) caused a 1-3% regression in biojava

Shaojin Wen swen at openjdk.org
Mon Jun 2 23:34:55 UTC 2025


On Fri, 30 May 2025 14:01:04 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> Comment out assertions added in JDK-8351443 from AbstractStringBuilder.ensureCapacityNewCoder that increase the codesize, preventing some inlining, and reducing performance
> 
>        assert coder == newCoder || newCoder == UTF16 : "bad new coder UTF16 -> LATIN1";
>        assert count <= newCapacity : "count exceeds new capacity";

The performance figures under x64 show that the performance of StringBuilders.appendWithIntLatin1 scenario drops by about 6%, but the performance of StringBuilders.appendWithLongLatin1 does not drop.

Someone from the optimizer team is needed to look at the assembly code generated under x64


# benfore
git checkout 68a118509a562334eb8c099129d79520041b10cf
make test TEST="micro:java.lang.StringBuilders.appendWithIntLatin1"

# after
git checkout 8fadf295b0ba720a5bc728c6b4d159e60447de97
make test TEST="micro:java.lang.StringBuilders.appendWithIntLatin1"


## Aliyun c8a (CPU AMD EPYC™ Genoa)

-# before 68a118509a562334eb8c099129d79520041b10cf
-Benchmark                           Mode  Cnt    Score   Error  Units
-StringBuilders.appendWithIntLatin1  avgt   15  136.055 ± 0.146  ns/op


+# after 8fadf295b0ba720a5bc728c6b4d159e60447de97
+Benchmark                            Mode  Cnt    Score   Error  Units
+StringBuilders.appendWithIntLatin1   avgt   15  146.498 ± 0.983  ns/op

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

PR Comment: https://git.openjdk.org/jdk/pull/25550#issuecomment-2932872603


More information about the core-libs-dev mailing list