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

Jim Laskey james.laskey at oracle.com
Tue Jun 16 13:32:41 UTC 2020



> On Jun 16, 2020, at 10:20 AM, Claes Redestad <claes.redestad at oracle.com> wrote:
> 
> On 2020-06-16 15:09, Jim Laskey wrote:
>> Would it be helpful to have benchmarks for the other types, just in case?
> 
> I'm not sure.. We need to be selective or we end up increasing expected
> run time by a large factor. We should also do a pass over most of these
> micros to provide saner defaults (number of forks, warmup times, run
> time etc are generally tuned a bit too high and we can get reasonable
> results on a smaller time budget)

okay.

> 
>> Don't see any tests to ensure all cases are covered. May be relying on existing tests, but... minimally tag those tests.
> 
> test/jdk/java/lang/String/concat/ImplicitStringConcatShapes.java tests
> these unary shapes exhaustively. I'll add the bug number to that (and
> the .template for it)

+1


> 
> /Claes
> 
>> Cheers,
>> -- Jim
>>> On Jun 16, 2020, at 10:00 AM, Claes Redestad <claes.redestad at oracle.com> wrote:
>>> 
>>> 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