Thursday 23 May 2013

Speed up your Eclipse IDE

When we use the Eclipse was heavy due to the performance of the laptop rather large memory usage. To reduce memory usage and make-eclipse eclipse faster, here are effective methods what I was try :

* Clean up history and indexes
* Remove structured text validation
* Do not use subclipse plugin
* Configure appropriate start-up arguments

1. Clean up history and indexes

Cleaning up history and indexes reduce the load on RAM, and overall HDD usage as well. This result in very high impact on performance. To remove the indexes and history folders, please cleanup all files/folders inside these two folders:

For cleaning up indexes

{workspace path}\.metadata\.plugins\org.eclipse.jdt.core

For cleaning up history

{workspace path}\.metadata\.plugins\org.eclipse.core.resources\.history

Here {workspace path} is the path of eclipse workspace where you create all projects.
Please note that deleting the files from above both folders does not impact any of your project sourcecode in any way.

2. Remove structured text validation

This one also makes a lot of impact. Validation here is necessarily means multiple things eclipse do with your sourcecode files in background to check their validity. These are sometimes very much un-necessary and annoying too. I have worked on some projects consisting of lots of XML/XSLT and WSDL files, and some of these files always showing some red flags. But they created any problem in runtime, and in fact most of time, if was actually correct way to do things as well.

You can turn off these validations (for all types which you feel un-necessary) and enjoy a performing eclipse.

To turn off these text validations, open Windows > Preferences and in search bar type “validation”. It will list down all files types and applied validations on them. Disable whichever you feel un-necessary. And click OK.

3. Do not use subclipse plugin

This technique is really effective but hard to follow. It says that you should use your code in eclipse only for writing/modifying and executing. All other things related to SVN/perforce or any code repository should be done outside eclipse. This can be from a command line tool or any visual client.

Subversion plugin uses too much system resources and effects eclipse performance badly.

4. Configure appropriate start-up arguments

In your eclipse.ini file (inside eclipse installation folder) change the default -Xms40m -Xmx256m arguments as per your needs. This option defines the minimum and maximum memory usage bounds which are passed to java virtual memory to manage eclipse application’s memory allocation tolerance. You should not set them to maximum available because you need other softwares to run in parallel.

My sample config :
  

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120913-144807
-product
com.android.ide.eclipse.adt.package.adtproduct
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xverify:none
-Xquickstart
-server
-Xmn128m
-Xms512m
-Xmx1024m
-Xss2m
-XX:PermSize=128m
-XX:MaxPermSize=128m
-XX:+UseParallelGC

-Xquickstart
You can use -Xquickstart for initial compilation at a lower optimization level than in default mode. Later, depending on sampling results, you can recompile to the level of the initial compile in default mode. Use -Xquickstart for applications where early moderate speed is more important than long run throughput. In some debug scenarios, test harnesses and short-running tools, you can improve startup time between 15-20%.

-Xverify:none
You can use -Xverify:none if you want to skip the class verification stage during class loading . Using -Xverify:none disables Java class verification, which can provide a 10-15% improvement in startup time. However corrupted or invalid class data is not detected when this option is specified. If corrupt class data is loaded, the Java Virtual Machine (JVM) might behave in an unexpected manner, or the JVM might fail. But this can only happen, when you are making byte code modifications youself.

-server | -client
Java HotSpot Technology in the Sun-based Java Development Kit (JDK) Version 1.4.2 introduces an adaptive JVM containing algorithms for optimizing byte code execution over time. The JVM runs in two modes, -server and -client. If you use the default -client mode, there will be a faster start-up time and a smaller memory footprint, but lower extended performance. You can enhance performance by using -server mode if a sufficient amount of time is allowed for the HotSpot JVM to warm up by performing continuous execution of byte code. In most cases, use -server mode, which produces more efficient run-time execution over extended periods. You can monitor the process size and the server startup time to check the difference between -client and -server.

Ok that all the tips
Thank You 'How To Do In Java'