RFR: 8337282: Speed ​​up StringConcat with more simpleConcat

Chen Liang liach at openjdk.org
Fri Jul 26 21:31:30 UTC 2024


On Fri, 26 Jul 2024 15:56:14 GMT, Shaojin Wen <duke at openjdk.org> wrote:

> StringConcatFactory improves startup speed and running performance through simpleConcat, but simpleConcat is currently given priority and only supports the following scenarios:
> 
> // x instanceof Object
> prefix + x
> x = subfix
> 
> // x instanceof Object && z instanceof Object
> x + y
> 
> 
> This PR improves startup and running performance by supporting more scenarios including
> 
> // x instanceof byte/short/int/char/boolean/float/double
> prefix + x
> x + suffix
> 
> // x instanceof byte/short/int/char/boolean/float/double/Integer/Long/Object
> prefix + suffix
> 
> // x instanceof Object
> x + y + suffix
> 
> // x instanceof Object
> x + y + suffix

I don't think this pr will ever get merged, but this will be a good experiment mailing list thread for investigating whether to generate similar simpleConcat in bytecode for String concatenation.

|| baseline | current | delta
-- | -- | -- | --
StringConcatStartup.StringSingle.constIntString | 0.159 | 0.559 | -71.56%
StringConcatStartup.StringSingle.constBooleanString | 0.261 | 0.575 | -54.61%
StringConcatStartup.StringSingle.constInteger | 0.140 | 0.154 | -9.09%
StringConcatStartup.StringSingle.constString | 0.138 | 0.149 | -7.38%

There are non-trivial slowdowns. Can you explain why these slowdowns happen, and is there some particular types of simpleConcat that benefit more from your specialization that they indeed should be specialized?

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

PR Comment: https://git.openjdk.org/jdk/pull/20355#issuecomment-2253532207


More information about the core-libs-dev mailing list