Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8337279

Share StringBuilder to format instant

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 25
    • 25
    • core-libs
    • None
    • b16

      1. Create a tool class jdk.internal.util.DateTimeHelper, move the formatTo method of LocalDateTime/LocalDate/LocalTime to it, so that these methods can be used across packages within JDK, so that StringBuilder can be shared, avoiding multiple creation of StringBuilder and toString.
      2. Refactor DateTimeFormatterBuilder::format to use the jdk.internal.util.DateTimeHelper::formatTo method.
      3. Split the DateTimeFormatterBuilder::format method, separate the currentEra and beforeCurrentEra sub-methods, so that codeSize < 325 can be inlined. Most scenarios call currentEra, so performance is improved.

            swen Shaojin Wen
            swen Shaojin Wen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: