RFR: 8288327: Executable.hasRealParameterData should not be volatile [v7]

Peter Levart plevart at openjdk.org
Mon Jul 4 06:22:40 UTC 2022


On Sun, 3 Jul 2022 20:12:13 GMT, liach <duke at openjdk.org> wrote:

>> With `static` and without `@Stable` the benchmark yields
>> 
>> Benchmark                            Mode  Cnt  Score   Error  Units
>> AccessParamsBenchmark.getParameter0  avgt   10  1,212 ± 0,083  ns/op
>> AccessParamsBenchmark.getParameters  avgt   10  2,493 ± 0,076  ns/op
>> 
>> and with `@Stable`
>> 
>> Benchmark                            Mode  Cnt  Score   Error  Units
>> AccessParamsBenchmark.getParameter0  avgt   40  0,427 ± 0,007  ns/op
>> AccessParamsBenchmark.getParameters  avgt   40  2,123 ± 0,052  ns/op
>> 
>> so the annotation is useful.
>
> hmm, is the faster getParameters (without explicit index access) a result of the annotation? getParameter0 shows the documented effect but isn't quite our use case here.

...neither is obtaining a cloned array and passing its reference to JMH's black hole our usecase... Still, it seems that even part of that has some advantage. I would keep the @stable annotation then.

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

PR: https://git.openjdk.org/jdk/pull/9143


More information about the core-libs-dev mailing list