Make Eclipse Faster in 5 Minutes
Once we start working on eclipse, it gradually becomes slower. To improve the performance and make eclipse faster, there are certain ways which you can utilize and see noticeable differences. These effective method are listed below:
1) Clean up history and indexes
2) Remove structured text validation
3) Do not use subclipse plugin
4) Configure appropriate start-up arguments
Let’s understand them in detail one by one:
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.
eclipse_validation
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.
Even if you really want to use it, then checkout only certain part of code through subclipse, and rest of code import as external project. It will also help you.
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.
You should try different combinations of -Xms and -Xmx options, and then decide which one works for you best and make eclipse fastest.
A sample config looks like this:
-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.v20120522-1813
-product
org.eclipse.epp.package.jee.product
–launcher.defaultAction
openFile
–launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
–launcher.XXMaxPermSize
256m
–launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dhelp.lucene.tokenizer=standard
-Xms256m
-Xmx1024m
Bonus Tip: Use -Xverify:none, -Xquickstart and -server OR -client in eclipse.ini
-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.
That’s it for now. If you know any technique other than above listed ones, please share with us.