On Wed, 24 Jul 2024 10:18:03 GMT, Shaojin Wen <d...@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 ten additional 
> commits since the last revision:
> 
>  - minor refactor
>  - minor refactor
>  - reduce change
>  - copyright
>  - reduce change
>  - refactor based on 8335182
>  - use Float.toString & Double.toString
>  - remove ForceInline
>  - fix build error

Now, the implementation algorithm is the same as the MH-based implementation. 
The difference is that the original implementation was based on MethodHandle, 
but now it is based on bytecode-spinning, so no additional changes are required 
to StringConatHelper, and the performance is the same.


- MH-based
-@ 8   java.lang.invoke.LambdaForm$MH/0x00000800000d5000::linkToTargetMethod 
(10 bytes)   force inline by annotation
-  @ 6   java.lang.invoke.LambdaForm$MH/0x00000800000d4800::invoke (80 bytes)   
force inline by annotation
-    @ 16   java.lang.invoke.LambdaForm$MH/0x00000800000d4000::invoke (46 
bytes)   force inline by annotation
-      @ 23   java.lang.invoke.LambdaForm$BMH/0x00000800000d2c00::reinvoke (20 
bytes)   force inline by annotation
-        @ 16   
java.lang.invoke.LambdaForm$DMH/0x00000800000d2400::invokeStatic (17 bytes)   
force inline by annotation
-          @ 1   java.lang.invoke.DirectMethodHandle::internalMemberName (8 
bytes)   force inline by annotation

+ bytecode-spinning
+@ 8   java.lang.invoke.LambdaForm$MH/0x00000ff8000cd800::linkToTargetMethod 
(10 bytes)   force inline by annotation
+  @ 6   java.lang.invoke.LambdaForm$DMH/0x00000ff8000cd000::invokeStatic (15 
bytes)   force inline by annotation
+    @ 1   java.lang.invoke.DirectMethodHandle::internalMemberName (8 bytes)   
force inline by annotation


Based on bytecode-spinning, some intermediate classes will be generated less, 
which should improve the startup time, but how to analyze the startup time? Can 
anyone help?

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

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

Reply via email to