On Fri, 6 Nov 2020 08:58:13 GMT, Joel Borggrén-Franck <jfra...@openjdk.org> 
wrote:

> Are there any benchmarks to compare this accessor with the previous version 
> in the presumably common case where there is no or very little contention? 
> Edit to clarify: it is stated as "trivial" is this also measured somewhere?

@jbf  in presumably common case,  one extra CAS is added when invocation reach 
threshold.
MethodInvoke in jdk repo micro benchmark test shows no regression with this 
patch.

**Before patch**
Benchmark                                  Mode  Cnt   Score   Error  Units
MethodInvoke.invokeWithSixObjectParams     avgt   25   5.443 ? 0.008  ns/op
MethodInvoke.invokeWithSixPrimitiveParams  avgt   25  10.195 ? 0.020  ns/op
MethodInvoke.invokeWithoutParams           avgt   25   3.919 ? 0.011  ns/op

Benchmark                                  Mode  Cnt   Score   Error  Units
MethodInvoke.invokeWithSixObjectParams     avgt   25   5.440 ? 0.012  ns/op
MethodInvoke.invokeWithSixPrimitiveParams  avgt   25  10.197 ? 0.028  ns/op
MethodInvoke.invokeWithoutParams           avgt   25   3.923 ? 0.010  ns/op

**After patch**
Benchmark                                  Mode  Cnt   Score   Error  Units
MethodInvoke.invokeWithSixObjectParams     avgt   25   5.438 ? 0.005  ns/op
MethodInvoke.invokeWithSixPrimitiveParams  avgt   25  10.190 ? 0.038  ns/op
MethodInvoke.invokeWithoutParams           avgt   25   3.930 ? 0.010  ns/op
Finished running test 'micro:java.lang.reflect.MethodInvoke'

Benchmark                                  Mode  Cnt   Score   Error  Units
MethodInvoke.invokeWithSixObjectParams     avgt   25   5.442 ? 0.009  ns/op
MethodInvoke.invokeWithSixPrimitiveParams  avgt   25  10.205 ? 0.034  ns/op
MethodInvoke.invokeWithoutParams           avgt   25   3.916 ? 0.005  ns/op

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

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

Reply via email to