RFR: 8338532: Speed up the ClassFile API MethodTypeDesc#ofDescriptor

Shaojin Wen duke at openjdk.org
Mon Aug 19 17:00:55 UTC 2024


On Mon, 19 Aug 2024 14:43:44 GMT, Chen Liang <liach at openjdk.org> wrote:

>> I added two startup process descStrings to the benchmark, and now optimized the parameter type of `Ljava/lang/Object` as follows:
>> 
>> ## 1. Benchmark script
>> 
>> git remote add wenshao git at github.com:wenshao/jdk.git
>> git fetch wenshao
>> 
>> # baseline
>> git checkout b83e2705662aa444338586713a2a7b2fa7852ba6
>> make test TEST="micro:java.lang.constant.MethodTypeDescFactories.ofDescriptor"
>> 
>> # current
>> git checkout 2405e63af284d4074056be40c550918541eead3a
>> make test TEST="micro:java.lang.constant.MethodTypeDescFactories.ofDescriptor"
>> 
>> 
>> ## 2. Performance numbers
>> 
>> ### 2.1 Mac Book M1 Pro
>> 
>> 
>> -# baseline
>> -Benchmark                                                                         (descString)  Mode  Cnt     Score     Error  Units
>> -MethodTypeDescFactories.ofDescriptor                   (Ljava/lang/Object;Ljava/lang/String;)I  avgt    6   100.245 ?   3.888  ns/op
>> -MethodTypeDescFactories.ofDescriptor                                                       ()V  avgt    6     3.762 ?   0.024  ns/op
>> -MethodTypeDescFactories.ofDescriptor  (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;  avgt    6   148.798 ?  21.645  ns/op
>> -MethodTypeDescFactories.ofDescriptor                                      ()Ljava/lang/Object;  avgt    6    23.890 ?   0.053  ns/op
>> -MethodTypeDescFactories.ofDescriptor                  ([IJLjava/lang/String;Z)Ljava/util/List;  avgt    6   220.012 ?  63.268  ns/op
>> -MethodTypeDescFactories.ofDescriptor                                     ()[Ljava/lang/String;  avgt    6    20.612 ?   0.031  ns/op
>> -MethodTypeDescFactories.ofDescriptor                                                  (..IIJ)V  avgt    6   167.894 ? 153.553  ns/op
>> -MethodTypeDescFactories.ofDescriptor                                         ([III.Z[B..[.[B).  avgt    6   342.610 ?   2.296  ns/op
>> -MethodTypeDescFactories.ofDescriptor                                  (.....................).  avgt    6  1115.834 ?   1.067  ns/op
>> 
>> +# current
>> +Benchmark                                                                         (descString)  Mode  Cnt     Score   Error  Units
>> +MethodTypeDescFactories.ofDescriptor                   (Ljava/lang/Object;Ljava/lang/String;)I  avgt    6    48.616 ? 0.440  ns/op
>> +MethodTypeDescFactories.ofDescriptor                                                       ()V  avgt    6     1.400 ? 0.004  ns/op
>> +MethodTypeDescFactories.ofDescriptor  (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Objec...
>
> @wenshao Can you confirm that this PR is feature frozen, that you won't add new tricks or optimizations here? Reviewers can only start reviewing if you won't bring in other changes that invalidate reviews.

@liach Yes, I confirm that I don't plan to make any changes, so I set the PR draft to read for review.

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

PR Comment: https://git.openjdk.org/jdk/pull/20611#issuecomment-2297022659


More information about the core-libs-dev mailing list