RFR [9]: 8050142: Optimize java.util.Formatter

Peter Levart peter.levart at gmail.com
Mon Jul 14 11:25:10 UTC 2014


On 07/14/2014 12:07 PM, Claes Redestad wrote:
> Hi,
>
>  please review this patch which optimizes away some allocations from 
> java.util.Formatter and achieve 1.1-1.3x speedups of micros targetting 
> String.format. See bug for more details.
>
>  webrev: http://cr.openjdk.java.net/~redestad/8050142/webrev.0
>  bug: https://bugs.openjdk.java.net/browse/JDK-8050142
>
>  Testing: JPRT, jtreg (java/lang/String, java/util/Formatter), 
> SPECjbb2013 and microbenchmarks
>
>  Thanks!
>
>  /Claes

Hi Claes,

Since justify() result is always appended to the resulting Appendable, 
you could merge the functionality and eliminate constructing 
intermediary StringBuilder altogether:

http://cr.openjdk.java.net/~plevart/jdk9-dev/Formatter/webrev.01/

Regards, Peter



More information about the core-libs-dev mailing list