RFR: 8287292: Improve TransformKey to pack more kinds of transforms efficiently [v3]

Claes Redestad redestad at openjdk.java.net
Wed May 25 14:13:52 UTC 2022


> The bespoke caching scheme in `jl.invoke.LambdaFormEditor.TransformKey` allows keys to be compacted when all byte values of the key fit in 4 bits, otherwise a byte array is allocated and used. This means that all transforms with a kind value above 15 will be forced to allocate and use array comparisons.
> 
> Removing unused and folding some transforms to ensure all existing kinds can fit snugly within the 0-15 value range realize a minor improvement to footprint, speed and allocation pressure of affected transforms, e.g. ~300bytes/op reduction in the `StringConcatFactoryBootstraps` microbenchmark:
> 
> Baseline:
> 
> Benchmark                                                      Mode  Cnt     Score     Error   Units
> SCFB.makeConcatWithConstants                                   avgt   15  2048.475 ?  69.887   ns/op
> SCFB.makeConcatWithConstants:?gc.alloc.rate.norm               avgt   15  3487.311 ?  80.385    B/op
> 
> 
> Patched:
> 
> Benchmark                                                      Mode  Cnt     Score     Error   Units
> SCFB.makeConcatWithConstants                                   avgt   15  1961.985 ? 101.519   ns/op
> SCFB.makeConcatWithConstants:?gc.alloc.rate.norm               avgt   15  3156.478 ? 183.600    B/op

Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:

  Missed correctly taking b1 into account in of(byte, int, int...) (java/lang/String/concat/ImplicitStringConcatShapes.java test failure)

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8881/files
  - new: https://git.openjdk.java.net/jdk/pull/8881/files/2be3b25c..612b4ece

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8881&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8881&range=01-02

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8881.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8881/head:pull/8881

PR: https://git.openjdk.java.net/jdk/pull/8881


More information about the core-libs-dev mailing list