RFR: 8295555: Primitive wrapper caches could be `@Stable`
Per Minborg
pminborg at openjdk.org
Mon Jun 12 14:41:23 UTC 2023
On Mon, 12 Jun 2023 14:25:42 GMT, Per Minborg <pminborg at openjdk.org> wrote:
> This PR proposes adding `@Stable` to certain wrapper classes' cache arrays (e.g. `Integer` and `Long`).
>
> Comments are welcome as to how to improve the VM's handling now that the backing cache array is `@Stable`. Are there simplifications to be made or are there other optimizations we might add?
The performance is similar with this PR compared to the base line:
Before:
Benchmark (size) Mode Cnt Score Error Units
Integers.valueOf 500 avgt 15 0.652 ± 0.003 ns/op
After
Benchmark (size) Mode Cnt Score Error Units
Integers.valueOf 500 avgt 15 0.649 ± 0.003 ns/op
@State(Scope.Thread)
public static class Data {
int value = 42;
}
...
@Benchmark
public void valueOf(Data data, Blackhole bh) {
bh.consume(Integer.valueOf(data.value));
}
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14418#issuecomment-1587463431
More information about the core-libs-dev
mailing list