RFR [9]: 8050142: Optimize java.util.Formatter (original) (raw)
Claes Redestad claes.redestad at oracle.com
Mon Jul 14 12:17:16 UTC 2014
- Previous message: RFR [9]: 8050142: Optimize java.util.Formatter
- Next message: RFR [9]: 8050142: Optimize java.util.Formatter
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Peter,
On 2014-07-14 14:05, Peter Levart wrote:
On 07/14/2014 01:29 PM, Claes Redestad wrote:
Hi Peter,
On 2014-07-14 13:25, Peter Levart wrote: 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/ Looks good, especially eliminating the need for two different append methods. I'll update based on this and other suggestions. /Claes Regards, Peter Hi Claes, If you're in a really hyper-optimizing mood, you could also eliminate construction of ArrayList in parse(): http://cr.openjdk.java.net/~plevart/jdk9-dev/Formatter/webrev.02/
Have you measured this to have a real effect? I'm not convinced it would matter enough to warrant the extra complexity of turning FormatString into a linked list. I feel this patch is already a bit saturated with different small optimizations - maybe should deal with this in a new RFE?
/Claes
Regards, Peter
- Previous message: RFR [9]: 8050142: Optimize java.util.Formatter
- Next message: RFR [9]: 8050142: Optimize java.util.Formatter
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]