RFR(S): 8055004: Reduce allocation overhead in java.time.Period/Duration parse methods
Xueming Shen
xueming.shen at oracle.com
Wed Aug 13 19:49:20 UTC 2014
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
More information about the core-libs-dev
mailing list