RFR: 8338937: Optimize the string concatenation of ClassDesc
ExE Boss
duke at openjdk.org
Sun Aug 25 17:04:03 UTC 2024
On Sun, 25 Aug 2024 13:36:34 GMT, Shaojin Wen <duke at 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
More information about the core-libs-dev
mailing list