RFR: 8336856: Optimize String Concat [v16]

Shaojin Wen duke at openjdk.org
Thu Jul 25 16:00:34 UTC 2024


On Thu, 25 Jul 2024 14:52:11 GMT, Shaojin Wen <duke at openjdk.org> wrote:

>> The current implementation of StringConcat is to mix the coder and length into a long. This operation will have some overhead for int/long/boolean types. We can separate the calculation of the coder from the calculation of the length, which can improve the performance in the scenario of concat int/long/boolean.
>> 
>> This idea comes from the suggestion of @l4es in the discussion of PR https://github.com/openjdk/jdk/pull/20253#issuecomment-2240412866
>
> Shaojin Wen has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - remove benchmark
>  - common simpleConcat

Startup performance is better when simpleConcat works, so I use highArity and bytecode-spinning only when simpleConcat doesn't work.

Should we add some simpleConcat implementations, such as:


String simpleConcat(Object arg0, int arg1);
String simpleConcat(Object arg0, long arg1)
String simpleConcat(Object arg0, boolean arg1)
String simpleConcat(int arg0, Object arg1)
String simpleConcat(long arg0, Object arg1)
String simpleConcat(boolean arg0, Object arg1)


This will help with startup performance

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

PR Comment: https://git.openjdk.org/jdk/pull/20273#issuecomment-2250787254


More information about the core-libs-dev mailing list