<i18n dev> RFR: 8301552: Use AtomicReferenceArray for caching instead of CHM in ZoneOffset [v6]

Per Minborg pminborg at openjdk.org
Thu Feb 2 15:44:54 UTC 2023


> `ZoneOffset` instances are cached by the `ZoneOffset` class itself for values in the range [-18h, 18h] for each second that is on an even quarter of an hour (i.e. at most 2*18*4+1 = 145 values). 
> 
> Instead of using a `ConcurrentHashMap` for caching instanced, we could instead use an `AtomicReferenceArray` with direct slot value access for said even seconds. This will improve performance and reduce the number of object even though the backing array will go from an initial 32 in the CHM to an initial/final 145 in the ARA. The CHM will contain much more objects and array slots for typical numbers of entries in the cache and will compute hash/bucket/collision on the hot code path for each cache access.

Per Minborg has updated the pull request incrementally with one additional commit since the last revision:

  Fix benchmark

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/12346/files
  - new: https://git.openjdk.org/jdk/pull/12346/files/48438fd8..1cd2b406

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=12346&range=05
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=12346&range=04-05

  Stats: 7 lines in 1 file changed: 1 ins; 2 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/12346.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12346/head:pull/12346

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


More information about the i18n-dev mailing list