JDK-8055004 : Reduce allocation overhead in java.time.Period/Duration parse methods
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.time
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2014-08-13
  • Updated: 2014-08-29
  • Resolved: 2014-08-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b28Fixed
Related Reports
Relates :  
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