RFR: 8213741: Consolidate Object and String Stringifiers

Claes Redestad claes.redestad at oracle.com
Mon Nov 12 14:24:15 UTC 2018


following up on JDK-8213478[1], this patch consolidates the use of 
"Stringifiers" in StringConcatFactory to use a single Stringifier for 
all String and Object arguments. This has the effect that repeated 
filters become much more common with the default implementation, and can 
reduce the number of species and LF classes generated by almost a third 
in extreme cases[2], but still around a 10-15% reduction on average in 
any test that mix Strings and Object arguments.

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

The consolidation theoretically means an extra branch in the case of 
String arguments, but any cost from that appears lost in the noise on my 
measurements. OTOH, the simplified shape for Object arguments (a simple 
MH rather than a chained one) means a significant speedup (up to around 
1.3x) in microbenchmarks with Object arguments.



[1] https://bugs.openjdk.java.net/browse/JDK-8213478

[2] http://cr.openjdk.java.net/~redestad/8213741/BadStringConcat.java

$ time $BASELINE/bin/java -Xlog:class+load BadStringConcat | grep 
"MH\|Species" | wc -l

real    0m1.285s
user    0m6.024s
sys    0m0.216s

$ time $TEST/bin/java -Xlog:class+load BadStringConcat | grep 
"MH\|Species" | wc -l

real    0m0.759s
user    0m4.092s
sys    0m0.136s

More information about the core-libs-dev mailing list