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?
Considering String performance, have a look at the -XX:+PrintStringTableStatistics
and -XX:StringTableSize=
. Java 7 comes with nice features that allow tuning of String cache when using the interned Strings. This way you can optimize the String cache size.
And, a related String Performance Q/A: Java GC tuning for strings