Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JVM option XX:UseFastEmptyMethods/XX:UseFastAccessorMethods

While looking at possible JVM flags for optimizing launching startup time of my RCP product, I found these attractively-named -XX:UseFastEmptyMethods and -XX:UseFastAccessorMethods.

It seems that those flags were available on JDK-6 (and on by default), while they were defaulted to off on JDK-7. Also, I read that the trade-off for this optimization is that they do not increase method invocation counters.

What is the impact of not using invocation counters? Does that affect garbage collection?

like image 576
guido Avatar asked Mar 14 '13 04:03

guido


People also ask

What is JVM option?

The JVM option,-verbose:dynloadprovides detailed information as each class is loaded by the JVM, including:The class name and packageFor class files that were in a . jar file, the name and directory path of the . jarDetails of the size of the class and the time taken to load the classThe data is written out to stderr.

Where can I find JVM options?

options configuration file. The default location of this file is config/jvm. options (when installing from the tar or zip distributions) and /etc/elasticsearch/jvm. options (when installing from the Debian or RPM packages).

What are JVM parameters?

The following three JVM options specify initial and max heap size and thread stack size while running Java programs: -Xms - set initial Java heap size -Xmx - set maximum Java heap size -Xss - set java thread stack size. Parameter 2: Garbage Collector.


1 Answers

It is for getting the invocation count of methods correctly so that the VM can identify the hotspots in your code better.

Following the discussion from here

If you're on JDK6, you may need to include these two VM flags in your target Java application:
-XX:-UseFastEmptyMethods -XX:-UseFastAccessorMethods

Otherwise empty methods and accessor methods will not show up in the list, because the "fast" version doesn't increment the invocation counter for these methods. In JDK7 these two flags default to false, so you don't have to bother setting them to false explicitly.


See Also :

UseFastEmptyMethods/UseFastAccessorMethods considered harmful

like image 137
Ajay George Avatar answered Sep 20 '22 05:09

Ajay George