RFR (S): 8065070: (fmt) Avoid creating substrings when building FormatSpecifier

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon Nov 17 10:45:04 UTC 2014


On 11/17/2014 02:09 AM, Claes Redestad wrote:
> http://cr.openjdk.java.net/~redestad/8065070/webrev.00
> https://bugs.openjdk.java.net/browse/JDK-8065070

(Not a Reviewer) The change looks very sane given the capture ranges are
already available in Matcher. I wonder if you want to cache m.start()
and m.end() in locals while you are at it -- I would think this amounts
to moving tTStart, tTEnd a few lines before.

> @Benchmark
> public String formatIndexedDoubleExpr() {
>     return String.format("%1$2.3f", pi);
> }
> 
> before: 1082.564   18.943  ops/ms
> after: 1309.945   18.219  ops/ms  # 1.21x

So this measures both the formatter setup costs and the actual
formatting, right? 1.21x on that composite operation means even more
speedup on formatter setup?

Thanks,
-Aleksey.






More information about the core-libs-dev mailing list