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

Reduce allocation overhead in java.time.Period/Duration parse methods

    XMLWordPrintable

Details

    • b28
    • generic
    • generic

    Backports

      Description

        java.time.Duration#parse uses a regex to parse a Strings like PT3M23.232S. Current method to parse this generates a number of String objects which are then parsed. By using offset based parse methods (8041972) we can avoid most String creation.

        Same thing applies to java.time.Period

        Other possible improvements:
        - not doing string concatenation to pad nanos fraction (parsing first then multiplying is up to 6x faster and allocation free)
        - not manifesting String objects (matcher.group(x)) for single char matches

        Attachments

          Issue Links

            Activity

              People

                redestad Claes Redestad
                redestad Claes Redestad
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: