RFR: 8246241: LambdaFormEditor should use a transform lookup key that is not a SoftReference

Claes Redestad claes.redestad at oracle.com
Mon Jun 1 11:07:00 UTC 2020


Hi,

the LambdaFormEditor uses a SoftReference-based cache to avoid
generating LambdaForms we have already generated. By introducing a
lookup key that is not a SoftReference we can improve this by allocating
less up front and by inducing less work for the GC later on.

I also refactored a few cases where I had neglected to add a static
factory method to create the Transform (now TransformKey). For the
transform types affected this helps further reduce allocations.

Bug:    https://bugs.openjdk.java.net/browse/JDK-8246241
Webrev: http://cr.openjdk.java.net/~redestad/8246241/open.00/

Testing: tier1-2, java/lang/invoke locally with STRESS_TEST=true

Verified a speed-up on the micro added by JDK-8246152)[1], and
on related startup tests[2].

Thanks!

/Claes

[1]
Before (JDK-8246152):
Benchmark Mode Cnt Score Error Units
StringConcatFactoryBootstraps.makeConcatWithConstants avgt 10 2764.634 ± 
56.244 ns/op
StringConcatFactoryBootstraps.makeConcatWithConstants:·gc.alloc.rate.norm 
avgt 10 4136.187 ± 0.013 B/op

After:
Benchmark 
                Mode  Cnt     Score     Error   Units
StringConcatFactoryBootstraps.makeConcatWithConstants avgt 10 2299.919 ± 
58.003 ns/op
StringConcatFactoryBootstraps.makeConcatWithConstants:·gc.alloc.rate.norm 
avgt 10 3308.145 ± 6.378 B/op

[2] 
http://cr.openjdk.java.net/~redestad/scratch/erase_scf_types.00/ObjStringCombos.java

Before (JDK-8246152):
      3,485,679,714      instructions              #    1.09  insn per 
cycle           ( +-  0.90% )
        692,247,529      branches                  #  491.822 M/sec 
          ( +-  0.92% )
         28,939,534      branch-misses             #    4.18% of all 
branches          ( +-  0.90% )

        0.291642667 seconds time elapsed          ( +-  0.93% )

After:
      3,411,619,586      instructions              #    1.09  insn per 
cycle           ( +-  0.63% )
        677,767,258      branches                  #  493.911 M/sec 
               ( +-  0.64% )
         28,337,022      branch-misses             #    4.18% of all 
branches          ( +-  0.63% )

        0.288959534 seconds time elapsed 
          ( +-  0.86% )


More information about the core-libs-dev mailing list