Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is current status of Oracle Java HotSpot VM performance options (+UseStringCache, +UseCompressedStrings, +OptimizeStringConcat)

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?

like image 949
Rade_303 Avatar asked Sep 26 '13 10:09

Rade_303


2 Answers

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
like image 153
BeeOnRope Avatar answered Nov 15 '22 19:11

BeeOnRope


To check defaults use

java -XX:+PrintFlagsFinal

To find exactly what you want you can

java -XX:+PrintFlagsFinal | grep UseCompressedStrings
like image 26
Tasm Avatar answered Nov 15 '22 20:11

Tasm