Optimizing string concatenation 

Prior to Java 9, string concatenation was translated by javac into StringBuilder : : append chains. This was a suboptimal translation methodology, often requiring StringBuilder presizing.

The enhancement changed the string concatenation bytecode sequence, generated by javac, so that it uses INVOKEDYNAMIC calls. The purpose of the enhancement was to increase optimization and to support future optimizations without the need to reformat the javac's bytecode.

See JEP 276 for more information on INVOKEDYNAMIC.

The use of INVOKEDYAMIC calls to java.lang.invoke.StringConcatFactory allows us to use a methodology similar to Lambda expressions, instead of using StringBuilder's stepwise process. This results in more efficient processing of string concatenation.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset