<i18n dev> RFR: 8372460: Use EnumMap instead of HashMap for DateTimeFormatter parsing to improve performance [v7]
Shaojin Wen
swen at openjdk.org
Sat Dec 20 05:26:50 UTC 2025
On Fri, 19 Dec 2025 21:42:14 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
> This version isn't well encapsulated and has changes across multiple files. What was suggested at the beginning of December is prototyped in PR #28936.
1. Using exceptions for logic control seems like a bad practice.
2. A DateTimeFormatter is reused multiple times. Our approach of calculating `onlyChronoField` only runs once during construction. However, using a runtime approach with `try-catch ClassCastException` executes the corresponding code every time `parse` is called. This is a choice between executing once and executing multiple times.
3. In the `DateTimeFormatter::checkField` method, we could later add an `int chronoFieldBitSet` field to record which ChronoFields are used. This could further optimize other methods of `Parsed`.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28471#issuecomment-3677403633
More information about the i18n-dev
mailing list