[jdk17u-dev] RFR: 8304976: Optimize DateTimeFormatterBuilder.ZoneTextPrinterParser.getTree()

Aleksey Shipilev shade at openjdk.org
Thu Jun 1 11:40:13 UTC 2023


On Thu, 1 Jun 2023 11:29:38 GMT, Oli Gillespie <ogillespie at openjdk.org> wrote:

>     * Use 2 with comment

Yes, this should do:


        // Cache per instance for now. These HashMaps normally contain a single
        // element, initialize them with initial capacity = 2 to avoid resizes due to load factor.
        private final Map<Locale, Entry<Integer, SoftReference<PrefixTree>>>
            cachedTree = new HashMap<>(2);
        private final Map<Locale, Entry<Integer, SoftReference<PrefixTree>>>
            cachedTreeCI = new HashMap<>(2);

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

PR Comment: https://git.openjdk.org/jdk17u-dev/pull/1414#issuecomment-1571885723


More information about the jdk-updates-dev mailing list