<i18n dev> Integrated: 8309622: Re-examine the cache mechanism in BaseLocale
Naoto Sato
naoto at openjdk.org
Mon Mar 4 18:44:00 UTC 2024
On Fri, 9 Jun 2023 22:17:39 GMT, Naoto Sato <naoto at openjdk.org> wrote:
> 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
This pull request has now been integrated.
Changeset: f615ac4b
Author: Naoto Sato <naoto at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/f615ac4bdf94750390d18aa954d41f72eb4ef4d2
Stats: 437 lines in 4 files changed: 43 ins; 267 del; 127 mod
8309622: Re-examine the cache mechanism in BaseLocale
Reviewed-by: dfuchs, rriggs
-------------
PR: https://git.openjdk.org/jdk/pull/14404
More information about the i18n-dev
mailing list