4 ms·
I wonder what effect +OptimiseStringConcat has on those benchmarks. It's supposed to collapse a lost of .append calls and tries to use the minimum amount of St
by briane80 10y ago
I wonder what effect +OptimiseStringConcat has on those benchmarks. It's supposed to collapse a lost of .append calls and tries to use the minimum amount of StringBuilder objects
- jcdavis 10y agoHuge, like several times faster (3x when I benchmarked IIRC). I'm a little surprised the author didn't mention it anywhere - it might account for some of the differences he saw. However with a normal JVM the only way to know if its happening (AFAIK) is to look at the compilation logs or JIT'd assembly, bytecode isn't enough
- alblue 10y agoFWIW I didn't mention/test the -XX:+OptimizeStringConcat, because the place where the changes were being made didn't have that flag enabled and as such wouldn't have been representative of the use case behind the blog post. In any case, I re-ran the benchmarks with -appendJvmArgs -XX:+OptimizeStringConcat and saw no significant difference in the timing on OSX. You can of course run the gist linked at the bottom and see for yourself whether there is an impact for your OS but there is JEP280 which is looking at generating invoke dynamic for Java 9 which will change the measurements again and make the -XX:+OptimizeStringConcat flag obsolete.
- jcdavis 10y ago-XX:+OptimizeStringConcat is enabled by default everywhere I can remember, AFAIK