<i18n dev> RFR: 8309622: Re-examine the cache mechanism in BaseLocale [v4]
Naoto Sato
naoto at openjdk.org
Thu Jun 29 19:28:05 UTC 2023
> This is stemming from the PR: https://github.com/openjdk/jdk/pull/14211 where aggressive GC can cause NPE in `BaseLocale$Key` class. I refactored the in-house cache with WeakHashMap, and removed the Key class as it is no longer needed (thus the original NPE will no longer be possible). Also with the new JMH test case, it gains some performance improvement:
>
> (w/o fix)
>
> Benchmark Mode Cnt Score Error Units
> LocaleCache.testForLanguageTag avgt 20 5781.275 ± 569.580 ns/op
> LocaleCache.testLocaleOf avgt 20 62564.079 ± 406.697 ns/op
>
> (w/ fix)
> Benchmark Mode Cnt Score Error Units
> LocaleCache.testForLanguageTag avgt 20 4801.175 ± 371.830 ns/op
> LocaleCache.testLocaleOf avgt 20 60394.652 ± 352.471 ns/op
Naoto Sato has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 14 additional commits since the last revision:
- Merge branch 'pull/14684' into JDK-8309622-Cache-BaseLocale
- Use ReferencedKeyMap in place for LocaleObjectCache
- Merge branch 'pull/14684' into JDK-8309622-Cache-BaseLocale
- Addressing review comments
- Addressing comments (test grouping, synchronization), minor optimization on loop lookup
- minor comment fix
- equals/hash fix, constructor simplification
- Removed Key
- minor fixup
- Use WeakHashMap
- ... and 4 more: https://git.openjdk.org/jdk/compare/8c52462a...870ec1fe
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/14404/files
- new: https://git.openjdk.org/jdk/pull/14404/files/ac6ea421..870ec1fe
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=14404&range=03
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=14404&range=02-03
Stats: 39769 lines in 1438 files changed: 16937 ins; 14906 del; 7926 mod
Patch: https://git.openjdk.org/jdk/pull/14404.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/14404/head:pull/14404
PR: https://git.openjdk.org/jdk/pull/14404
More information about the i18n-dev
mailing list