<i18n dev> RFR: 8372460: Use EnumMap instead of HashMap for DateTimeFormatter parsing to improve performance [v7]
Shaojin Wen
swen at openjdk.org
Fri Dec 19 02:46:55 UTC 2025
On Wed, 17 Dec 2025 12:11:14 GMT, Johannes Döbler <duke at openjdk.org> wrote:
>> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
>>
>> remove redundant checkField
>
> src/java.base/share/classes/java/time/format/DateTimeFormatter.java line 551:
>
>> 549: * This is used to optimize the storage of parsed field values in the Parsed class.
>> 550: */
>> 551: final boolean onlyChronoField;
>
> If you add to DateTimePrinterParser the method:
>
> public default boolean onlyChronoFields() {
> return true;
> }
>
> and override in CompositePrinterParser, NumberPrinterParser, TextPrinterParser, DefaultValueParser with obvious implementations you should be able to get rid of this field, same in DateTimeFormatterBuilder. (Or keep the field, but initialize in the constructor from printerParser).
https://github.com/openjdk/jdk/pull/28471/changes/d8742d7514abfe0e36f105fa7310fdb1755ae546
The initial version was similar to what you suggested. In the discussion above, I accepted liach's suggestion and modified it into the current implementation. I prefer the current implementation, and it will be easier to calculate chronoFieldsBitSet in the next step.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28471#discussion_r2633384391
More information about the i18n-dev
mailing list