RFR: 8309622: Re-examine the cache mechanism in BaseLocale [v7]
Naoto Sato
naoto at openjdk.org
Thu Feb 22 19:05:31 UTC 2024
On Thu, 22 Feb 2024 00:14:23 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
>
> Naoto Sato has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 34 commits:
>
> - Use ReferencedKeySet.intern()
> - Merge branch 'master' into JDK-8309622-Cache-BaseLocale
> - Merge branch 'master' into JDK-8309622-Cache-BaseLocale
> - Restored the test
> - Merge branch 'master' into JDK-8309622-Cache-BaseLocale
> - Merge branch 'master' of https://git.openjdk.org/jdk into JDK-8309622-Cache-BaseLocale
> - small cleanup
> - Merge branch 'pull/14684' into JDK-8309622-Cache-BaseLocale
> - Update ReferencedKeyTest.java
> - Simple versions of create
> - ... and 24 more: https://git.openjdk.org/jdk/compare/b419e951...32ec51f7
After a hiatus, I now got back to work on this. I think I reflected all the comments (and removed the performance bench because it no longer offers an improvement).
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14404#issuecomment-1960073243
More information about the core-libs-dev
mailing list