On Sun, 7 Feb 2021 19:08:18 GMT, Claes Redestad <redes...@openjdk.org> wrote:
> This patch refactor JDK internal charsets to initialize charset mapping data > lazily when needed via holder classes. This means both a startup improvement > in some cases, and possible throughput improvements for all DoubleByte-based > Charsets. > > Testing: tier1-3 Applications calling `Charset.availableCharsets()` might see a decent startup improvement (125-190ms -> 57-95ms first call overhead). All `DoubleByte`-derived charsets can see a throughput improvement on benchmarks thanks to removing DCL initialization checks with a Holder pattern implementation, which allows static data to be declared final and be more amenable to optimizations: Before: Benchmark (charsetName) Mode Cnt Score Error Units StringDecode.WithCharset.decodeCharset MS932 avgt 15 280.072 ± 17.217 ns/op StringDecode.WithCharset.decodeCharsetName MS932 avgt 15 289.368 ± 18.174 ns/op After: Benchmark (charsetName) Mode Cnt Score Error Units StringDecode.WithCharset.decodeCharset MS932 avgt 15 254.906 ± 15.095 ns/op StringDecode.WithCharset.decodeCharsetName MS932 avgt 15 268.241 ± 15.725 ns/op ------------- PR: https://git.openjdk.java.net/jdk/pull/2449