On Mon, 24 Nov 2025 08:02:35 GMT, Shaojin Wen <[email protected]> wrote:

> This PR optimizes the parsing performance of DateTimeFormatter by replacing 
> HashMap with EnumMap in scenarios where the keys are exclusively ChronoField 
> enum values.
> 
> When parsing date/time strings, DateTimeFormatter creates HashMaps to store 
> intermediate parsed values. HashMap has more overhead for operations compared 
> to specialized map implementations.
> 
> Since ChronoField is an enum and all keys in these maps are ChronoField 
> instances, we can use EnumMap instead, which provides better performance for 
> enum keys due to its optimized internal structure.
> 
> Parsing scenarios show improvements from 12% to 95%
> 
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has been closed without being integrated.

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

PR: https://git.openjdk.org/jdk/pull/28471

Reply via email to