RFR: 8336856: Optimize String Concat [v34]

Claes Redestad redestad at openjdk.org
Tue Aug 6 21:53:35 UTC 2024


On Tue, 6 Aug 2024 18:07:16 GMT, Shaojin Wen <duke at openjdk.org> wrote:

>> This PR implements the same algorithm as the current generateMHInlineCopy based on bytecode to improve startup performance.
>
> Shaojin Wen has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - copyright
>  - remove unused import

Yes, I'd suggest: 
- Rename `SimpleStringBuilderStrategy` to something like `InlineHiddenClassStrategy`.
- Change the default value of `highArity` to 0
- Adding a `inlineThreshold` parameter to control the now hard-coded inlining threshold

The only thing I'd really like to see after that is a test to verify that unloading of the hidden concat classes works. 

We should probably keep the existing strategy around for a while. At least until the new strategy has gone through extensive testing. Looking forward to the code cleanup removing it will entail, though.

On a review side note I see some opportunity to fine-tune the code a bit. For example:
- we could prefer generating and passing around `MethodTypeDesc` instead of `MethodType` to reduce transforms
- refactor to not generate `coderArgs` unless needed
- use more idiomatic class-file API code: `cb.parameterSlot(int)` instead of allocating `int[] paramSlots` arrays and calculating slows, use `cb.allocateLocal` etc..

Such micro-optimization/cleanup work probably isn't going to significantly change characteristics and could be deferred to a follow-up.

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

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


More information about the core-libs-dev mailing list