RFR: 8338930: StringConcatFactory hardCoded string concatenation strategy [v2]

Shaojin Wen duke at openjdk.org
Mon Aug 26 20:59:04 UTC 2024


On Sun, 25 Aug 2024 13:10:41 GMT, Claes Redestad <redestad at openjdk.org> wrote:

> > If the number of parameters is greater than 2, the probability of reuse may not be high. Using hard-coded constants can avoid the use of forceinline.
> 
> I think this entirely depends on the application. Too low a threshold and many applications will see an increase in number of generated classes. And perhaps we shouldn't assume _any_ high arity concatenations are performance sensitive enough that generating a class-per-call-site is ever a reasonable default. A good tunable for some applications, perhaps.
> 
> > From this PR, adding hard-coded constants only requires a small change, which may be a good solution.
> 
> It's good that layering this on top of the existing strategy is relatively straightforward, yes.

Support hardcoded constants so that we can use a smaller inlineThreshold, maybe the default values ​​of reuseThreshold and inlineThreshold can be set to 8.

I also added optimizations for CompactString, when CompactString is turned off, no coder method is generated.

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

PR Comment: https://git.openjdk.org/jdk/pull/20675#issuecomment-2311080376


More information about the core-libs-dev mailing list