On Mon, 31 Mar 2025 15:15:31 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
> > Here are the latest benchmarks run on an M1 (macOS): > > ``` > > Benchmark Mode Cnt Score > > Error Units > > StableFunctionBenchmark.function avgt 10 4.228 ? > > 0.172 ns/op > > StableFunctionBenchmark.map avgt 10 4.323 ? > > 0.289 ns/op > > StableFunctionBenchmark.staticIntFunction avgt 10 1.724 ? > > 0.121 ns/op > > StableFunctionBenchmark.staticSMap avgt 10 1.710 ? > > 0.045 ns/op > > StableFunctionSingleBenchmark.function avgt 10 4.329 ? > > 0.184 ns/op > > StableFunctionSingleBenchmark.map avgt 10 4.291 ? > > 0.142 ns/op > > StableFunctionSingleBenchmark.staticIntFunction avgt 10 0.704 ? > > 0.022 ns/op > > StableFunctionSingleBenchmark.staticSMap avgt 10 0.708 ? > > 0.027 ns/op > > StableIntFunctionBenchmark.intFunction avgt 10 1.558 ? > > 0.063 ns/op > > StableIntFunctionBenchmark.list avgt 10 1.579 ? > > 0.141 ns/op > > StableIntFunctionBenchmark.staticIntFunction avgt 10 1.044 ? > > 0.031 ns/op > > StableIntFunctionBenchmark.staticList avgt 10 2.280 ? > > 2.013 ns/op > > StableIntFunctionSingleBenchmark.intFunction avgt 10 2.333 ? > > 0.033 ns/op > > StableIntFunctionSingleBenchmark.list avgt 10 2.335 ? > > 0.046 ns/op > > StableIntFunctionSingleBenchmark.staticIntFunction avgt 10 0.670 ? > > 0.022 ns/op > > StableIntFunctionSingleBenchmark.staticList avgt 10 0.679 ? > > 0.021 ns/op > > StableSupplierBenchmark.stable avgt 10 1.377 ? > > 0.042 ns/op > > StableSupplierBenchmark.staticStable avgt 10 0.362 ? > > 0.077 ns/op > > StableSupplierBenchmark.staticSupplier avgt 10 0.338 ? > > 0.016 ns/op > > StableSupplierBenchmark.supplier avgt 10 1.609 ? > > 0.042 ns/op > > StableValueBenchmark.atomic avgt 10 1.357 ? > > 0.046 ns/op > > StableValueBenchmark.dcl avgt 10 1.369 ? > > 0.058 ns/op > > StableValueBenchmark.refSupplier avgt 10 0.442 ? > > 0.007 ns/op > > StableValueBenchmark.stable avgt 10 1.522 ? > > 0.267 ns/op > > StableValueBenchmark.stableNull avgt 10 1.237 ? > > 0.117 ns/op > > StableValueBenchmark.staticAtomic avgt 10 1.220 ? > > 0.058 ns/op > > StableValueBenchmark.staticDcl avgt 10 0.357 ? > > 0.022 ns/op > > StableValueBenchmark.staticHolder avgt 10 1.452 ? > > 0.205 ns/op > > StableValueBenchmark.staticRecordHolder avgt 10 0.367 ? > > 0.028 ns/op > > StableValueBenchmark.staticStable avgt 10 0.365 ? > > 0.026 ns/op > > Finished running test 'micro:java.lang.stable' > > ``` > > This seems an outlier: > > ``` > StableIntFunctionBenchmark.staticList avgt 10 2.280 ? 2.013 > ns/op > ``` > > (I also note the high error) > > I believe it could be useful to have one more benchmark showing a > `StableValue` holding a `MethodHandle` and do a `get()` + `invokeExact`. I > believe that should report more dramatic distinctions when compared to > atomic/dcl? Thanks for "hawk-eying" this discrepancy. There seemed to be some flux when I ran the benchmarks (I've used a laptop). Running the benchmarks in a more controlled environment revealed there was no difference. Also, rerunning the particular benchmark now shows: StableIntFunctionBenchmark.intFunction avgt 10 2.317 ? 1.252 ns/op StableIntFunctionBenchmark.list avgt 10 2.303 ? 1.302 ns/op StableIntFunctionBenchmark.staticIntFunction avgt 10 1.044 ? 0.036 ns/op StableIntFunctionBenchmark.staticList avgt 10 1.052 ? 0.061 ns/op I will add a `MethodHandle` benchmark. Good suggestion! ------------- PR Comment: https://git.openjdk.org/jdk/pull/23972#issuecomment-2766618937