RFR[16]: 8247681: Improve bootstrapping of unary concatenations

Claes Redestad claes.redestad at oracle.com
Tue Jun 16 13:00:10 UTC 2020


Hi,

this patch specializes bootstrapping of unary concatenation expressions.

Such expressions can be reduced to the canonical String.valueOf
"stringifier" for any primitive argument, but needs a special
stringifier for reference arguments since we need to produce a new
String to be compliant with JLS.

Bug:    https://bugs.openjdk.java.net/browse/JDK-8247681
Webrev: http://cr.openjdk.java.net/~redestad/8247681/open.00/

This ensures we get a similar speed-up as JDK-8247605 for
"" + fooString (and fooString + "").

Also speeds up bootstrapping for all such simple unary concatenation
expressions.

Testing: tier1+2

Before:

Benchmark                            (intValue)  Mode  Cnt   Score 
Error  Units
StringConcat.concatEmptyConstInt           4711  avgt    5  15.539 ± 
0.831  ns/op
StringConcat.concatEmptyConstString        4711  avgt    5  17.046 ± 
1.047  ns/op
StringConcat.concatEmptyLeft               4711  avgt    5   7.506 ± 
0.588  ns/op
StringConcat.concatEmptyRight              4711  avgt    5   7.890 ± 
0.314  ns/op

After:
Benchmark                            (intValue)  Mode  Cnt   Score 
Error  Units
StringConcat.concatEmptyConstInt           4711  avgt    5  15.410 ± 
0.944  ns/op
StringConcat.concatEmptyConstString        4711  avgt    5   7.397 ± 
0.384  ns/op
StringConcat.concatEmptyLeft               4711  avgt    5   7.465 ± 
0.328  ns/op
StringConcat.concatEmptyRight              4711  avgt    5   7.857 ± 
0.355  ns/op

Thanks!

/Claes


More information about the core-libs-dev mailing list