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