looks fine.
though arguably it might be more correct to do
if (dayStart != -1 || hourStart != -1 || minuteStart != -1 || secondStart !=
-1) {
...
}
as the regex spec says the start/end return -1 if no match for the group.
-Sherman
On 08/13/2014 05:50 AM, Claes Redestad wrote:
Hi,
can I have a review of this performance improvement to java.time.Period#parse
and java.time.Duration#parse?
bug: https://bugs.openjdk.java.net/browse/JDK-8055004
webrev: http://cr.openjdk.java.net/~redestad/8055004/webrev.0
The patch avoids String allocation through matcher.group(n) calls, utilizes
recently added
capability of parsing CharSequence offsets and improves on the rather awkward
way fractions of a second
was aligned to nanosecond precision in java.time.Duration.
Microbenchmarks show a 1.2-1.5x throughput improvement in both cases.
Thanks!
/Claes