On Thu, 25 Apr 2024 09:41:11 GMT, Claes Redestad <redes...@openjdk.org> wrote:

> When analyzing (startup) performance of the Classfile API I found this 
> opportunity to further improve `MethodTypeDescImpl::descriptorString`.
> 
> Performance improves across the board in existing microbenchmarks:
> 
> Name                                                                 
> (descString) Cnt   Base   Error    Test   Error  Unit  Change
> MethodTypeDescFactories.descriptorString  
> (Ljava/lang/Object;Ljava/lang/String;)I   6 55,179 ± 2,027  32,920 ± 1,189 
> ns/op   1,68x (p = 0,000*)
> MethodTypeDescFactories.descriptorString                                      
> ()V   6 17,689 ± 1,871  11,060 ± 0,331 ns/op   1,60x (p = 0,000*)
> MethodTypeDescFactories.descriptorString 
> ([IJLjava/lang/String;Z)Ljava/util/List;   6 86,627 ± 1,646  41,035 ± 0,636 
> ns/op   2,11x (p = 0,000*)
> MethodTypeDescFactories.descriptorString                    
> ()[Ljava/lang/String;   6 18,305 ± 1,974  13,110 ± 0,089 ns/op   1,40x (p = 
> 0,000*)
>   * = significant
> 
> 
> The improvement is even more pronounced when running with `-Xint`, which is 
> relevant for reducing startup overheads of early ClassFile API use:
> 
> Name                                                                 
> (descString) Cnt     Base      Error      Test     Error  Unit  Change
> MethodTypeDescFactories.descriptorString  
> (Ljava/lang/Object;Ljava/lang/String;)I   6 5122,061 ±   81,335  2626,481 ± 
> 101,466 ns/op   1,95x (p = 0,000*)
> MethodTypeDescFactories.descriptorString                                      
> ()V   6 3481,316 ±  258,904  1489,267 ±  15,506 ns/op   2,34x (p = 0,000*)
> MethodTypeDescFactories.descriptorString 
> ([IJLjava/lang/String;Z)Ljava/util/List;   6 7741,081 ± 1628,244  3281,778 ±  
> 41,892 ns/op   2,36x (p = 0,000*)
> MethodTypeDescFactories.descriptorString                    
> ()[Ljava/lang/String;   6 3677,803 ±   63,432  1495,291 ±   8,995 ns/op   
> 2,46x (p = 0,000*)
>   * = significant
>   ```
>   
>  I also applied similar approach to `MethodTypeDesc::displayDescriptor`: 
> while not performance sensitive I think these are so inter-related that it 
> makes sense to implement them in a similar fashion.

This pull request has now been integrated.

Changeset: a078b5e6
Author:    Claes Redestad <redes...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/a078b5e6117d2a99386fecd349eb0e0c11b74953
Stats:     34 lines in 5 files changed: 19 ins; 1 del; 14 mod

8331114: Further improve performance of MethodTypeDesc::descriptorString

Reviewed-by: mchung, liach

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

PR: https://git.openjdk.org/jdk/pull/18945

Reply via email to