I was reading Java HotSpot VM Options. I've seen some interesting VM switches, mostly pertaining to Strings - which is of great value to me since my app is doing some heavy String manipulation. Those are:
-XX:+UseStringCache
-XX:+UseCompressedStrings
-XX:+OptimizeStringConcat
I was wondering - are these switches on by default? What is real world experience in using them? Do they make a difference?
Based on my check of JDK6u21, JDK7u21 and JDK8u191 using PrintFlagsFinal, we have the following values:
JDK6u21 JDK7u21 JDK8u191
-XX:+UseStringCache false false <unsupported>
-XX:+UseCompressedStrings false <unsupported> <unsupported>
-XX:+OptimizeStringConcat false true true
To check defaults use
java -XX:+PrintFlagsFinal
To find exactly what you want you can
java -XX:+PrintFlagsFinal | grep UseCompressedStrings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With