When I migrated my jdk from jdk_8u261 to jdk11.0.11, the performance of String concat speed has dropped dramatically. For example, with the following code, jdk_8u261 spends about 1ms , jdk11.0.11 spends about 500ms. I realize that jdk11 make some optimization with String concatenation, such as StringConcatFactory and some concatenation strategy. I don't see why it is worser than jdk8 in my case. Here is the demo:
// alphabet concat test
String a = "a";String b = "b";String c = "c";String d = "d";String e = "e";
String f = "f";String g = "g";String h = "h";String i = "i";String j = "j";
String k = "k";String l = "l";String m = "m";String n = "n";String o = "o";
String p = "p";String q = "q";String r = "r";String s = "s";String t = "t";
String u = "u";String v = "v";String w = "w";String x = "x";String y = "y";
String z = "z";
long t1 = System.currentTimeMillis();
String str1 = a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p
+ q + r + s + t + u + v + w + x + y + z;
System.out.println(System.currentTimeMillis() - t1);