Use EnumMap instead of HashMap for DateTimeFormatter parsing to improve performance

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • 26
    • Affects Version/s: None
    • Component/s: core-libs
    • None

      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.

            Assignee:
            Shaojin Wen
            Reporter:
            Shaojin Wen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: