RFR (S) CR 8016236: Class.getGenericInterfaces performance improvement

Peter Levart peter.levart at gmail.com
Mon Jun 10 21:31:17 UTC 2013


Hi Aleksey,

While you're at it adding getInterfaces() cache, why not also 
getSuperclass()? Is it maybe already intrinsified?

Regards, Peter

On 06/10/2013 05:53 PM, Aleksey Shipilev wrote:
> Hi,
>
> This is the follow-up on the issue Doug identified:
>    http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-June/017798.html
>
> I had reworked the patch, webrev is here:
>    http://cr.openjdk.java.net/~shade/8016236/webrev.01/
>
> Notable differences from Doug's version are:
>    - handle non-generic cases as well
>    - reuse ReflectionData to cache the interfaces and generic signatures
>    - code style (chained ternary operators blown up)
>    - fixes the race along the way
>        http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6398355
>
> Testing:
>    - Linux x86_64/release: build OK
>    - Linux x86_64/release: java/lang/reflect regression tests OK
>    - Microbenchmarks show whooping increase in performance, see below
>
> (If there are no stylistic and other comments, I would like to do the
> JPRT submit and/or additional testing [which?]).
>
> The benchmark is here (you need JMH to build and run):
>    http://cr.openjdk.java.net/~shade/8016236/classbench.zip
>
> Before:
>> Benchmark                                       Mode Thr    Cnt  Sec         Mean   Mean error    Units
>> o.b.ClassBench.generic_getGenericInterfaces     avgt   1      5    1      326.835        1.220  nsec/op
>> o.b.ClassBench.generic_getGenericSuperclass     avgt   1      5    1      308.793        2.828  nsec/op
>> o.b.ClassBench.generic_getTypeParameters        avgt   1      5    1      312.627        1.637  nsec/op
>> o.b.ClassBench.raw_getGenericInterfaces         avgt   1      5    1      216.983        8.902  nsec/op
>> o.b.ClassBench.raw_getGenericSuperclass         avgt   1      5    1       59.933        0.183  nsec/op
>> o.b.ClassBench.raw_getTypeParameters            avgt   1      5    1       65.469        0.284  nsec/op
> Doug's version:
>> Benchmark                                       Mode Thr    Cnt  Sec         Mean   Mean error    Units
>> o.b.ClassBench.generic_getGenericInterfaces     avgt   1      5    1       15.106        0.271  nsec/op
>> o.b.ClassBench.generic_getGenericSuperclass     avgt   1      5    1        5.304        0.024  nsec/op
>> o.b.ClassBench.generic_getTypeParameters        avgt   1      5    1       16.739        0.045  nsec/op
>> o.b.ClassBench.raw_getGenericInterfaces         avgt   1      5    1      213.825        1.346  nsec/op
>> o.b.ClassBench.raw_getGenericSuperclass         avgt   1      5    1       61.651        0.394  nsec/op
>> o.b.ClassBench.raw_getTypeParameters            avgt   1      5    1       64.340        0.522  nsec/op
> After:
>> Benchmark                                       Mode Thr    Cnt  Sec         Mean   Mean error    Units
>> o.b.ClassBench.generic_getGenericInterfaces     avgt   1      5    1       14.985        0.104  nsec/op
>> o.b.ClassBench.generic_getGenericSuperclass     avgt   1      5    1        5.300        0.008  nsec/op
>> o.b.ClassBench.generic_getTypeParameters        avgt   1      5    1       16.874        0.175  nsec/op
>> o.b.ClassBench.raw_getGenericInterfaces         avgt   1      5    1       23.941        0.177  nsec/op
>> o.b.ClassBench.raw_getGenericSuperclass         avgt   1      5    1        8.583        0.044  nsec/op
>> o.b.ClassBench.raw_getTypeParameters            avgt   1      5    1       12.400        0.045  nsec/op
> Thanks,
> Aleksey.




More information about the core-libs-dev mailing list