On Sun, 25 Aug 2024 13:36:34 GMT, Shaojin Wen <d...@openjdk.org> wrote:

> Optimize ClassDesc related string concatenation, which will reduce object 
> allocation during startup.

src/java.base/share/classes/java/lang/StringConcatHelper.java line 787:

> 785:     }
> 786: 
> 787:     static String concat(String prefix, String value, String suffix) {

`Class​::descriptorString()` can probably also make use of this method and 
`String​::concat​(String)`:

if (isArray()) {
        return "[".concat(componentType.descriptorString());
} else if (isHidden()) {
        // unchanged
} else {
        String name = getName().replace('.', '/');
        return StringConcatHelper.concat("L", name, ";");
}

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20705#discussion_r1730395340

Reply via email to