RFR: 8281168: Micro-optimize VarForm.getMemberName for interpreter

Claes Redestad redestad at openjdk.java.net
Mon Feb 7 13:37:04 UTC 2022


On Thu, 3 Feb 2022 07:20:28 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> I was looking for easy things to do to improve `java.lang.invoke` cold performance. One of the things is inlining `VarForm.getMemberName` a bit, so that interpreter does not have to call through `getMemberNameOrNull`.
> 
> There is direct VarHandle benchmark in our corpus:
> 
> 
> $ CONF=linux-x86_64-server-release make run-test TEST=micro:java.lang.invoke.VarHandleExact MICRO="TIME=200ms;WARMUP_TIME=200ms;VM_OPTIONS=-Xint"
> 
> Benchmark                                 Mode  Cnt     Score    Error  Units
> 
> # -Xint
> # Baseline
> VarHandleExact.exact_exactInvocation      avgt   30   714.041 ±  5.882  ns/op
> VarHandleExact.generic_exactInvocation    avgt   30   641.570 ± 11.681  ns/op
> VarHandleExact.generic_genericInvocation  avgt   30  1336.571 ± 11.873  ns/op
> 
> # -Xint
> # Patched
> VarHandleExact.exact_exactInvocation      avgt   30   678.495 ± 10.752  ns/op ; +5%
> VarHandleExact.generic_exactInvocation    avgt   30   573.320 ±  5.100  ns/op ; +11%
> VarHandleExact.generic_genericInvocation  avgt   30  1338.593 ± 14.275  ns/op 
> 
> # (server, default)
> # Baseline
> VarHandleExact.exact_exactInvocation      avgt   30   0.620 ± 0.079  ns/op
> VarHandleExact.generic_exactInvocation    avgt   30   0.602 ± 0.063  ns/op
> VarHandleExact.generic_genericInvocation  avgt   30  10.521 ± 0.065  ns/op
> 
> # (server, default)
> # Patched
> VarHandleExact.exact_exactInvocation      avgt   30   0.621 ± 0.070  ns/op
> VarHandleExact.generic_exactInvocation    avgt   30   0.601 ± 0.061  ns/op
> VarHandleExact.generic_genericInvocation  avgt   30  10.499 ± 0.070  ns/op
> 
> 
> Additional testing:
>  - [x] Linux x86_64 fastdebug `tier1`
>  - [x] Linux x86_64 fastdebug `tier2`
>  - [x] Linux x86_64 fastdebug `tier3`

Looks reasonable.

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

Marked as reviewed by redestad (Reviewer).

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


More information about the core-libs-dev mailing list