20 March, 2011

Tips for improving Eclipse Performance

Eclipse is a great development platform. However it may seems getting slower and slower over time. While I believe real solution to performance problem only comes after correctly identify the actual root cause, doing an objective measurement, however, will take some time. Before actually spent time on perform serious profiling, I gathered some "Tips" through googling. The tips are re-organized and presented below.

Tuning the Environment

Tools only perform well if you put it on a properly configured environment. Tips below suggest different means to ensure the environment is properly tuned for development purpose. These tips are general enough to applicable on different development platforms.
Disable anti-virus on demand scanning
During clean, build, running test, and launching application application, lots of file is being read, class files are created (temporary) and a lot of library (jar) is being loaded as well. Turning off On-demand scanning is the most important tips.
Disable file index (for example: Win7/Vista file indexing)
Eclipse will create a lot of output files, which have no sense to be indexed. Exclude these files from indexing.
Putting JVM, and Eclipse install on RAM Disk
By putting Eclipse and JDK on RAM Disk, Eclipse and JDK tools can be loaded more quickly.
Use the latest JDK and Eclipse
Traditional wisdom. Always stay on the latest stable!

Eclipse Startup Configuration

Another kind of tips involve fine tuning the Eclipse start up configuration. To a certain extents, this is a matter of arts, as the correct configuration may vary from case to case and requires in-depth knowledge on how JVM work.
Explicitly define the version of JDK to use, and point directly to the DLL instead of a Java Home directory.
In the configuration, use the "-vm" parameter to points to the jvm.dll directly:
-vm
C:/Program Files/Java/jdk1.6.0_24/jre/bin/server/jvm.dll
This brings the following advantages:
  • Splash screen coming up sooner.
  • Eclipse.exe in the process list instead of java.exe.
  • Firewalls: Eclipse wants access to the Internet instead of java.
  • Window management branding issues, especially on Windows and Mac.
This tips can be found on various StackOverflow post, and one of the Bugzilla entry on Eclipse
Tuning the Heap size and GC parameters
Depending on the size of the workspace, Eclipse should be given sufficient heap space. When large heap space is required, we also need to ensure a good GC and configuration is used.
The following is a proposed solution by VonC on StackOverflow:
-Xms128m
-Xmx384m
-Xss4m
-XX:PermSize=128m
-XX:MaxPermSize=384m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+CMSIncrementalPacing
-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC
-XX:+UseFastAccessorMethods

Eclipse User Preference

In Eclipse user preference, some functions may not be useful in every situation. As a result, the following options may worth spending time to fine tuned.
Disable unused options on Eclipse
Following options may have little use, consider turning it off
  • Label Decoration
  • Validators (Some validator may have nothing to do with the project you are working on)
  • UI fancy stuff
  • Disable unused content assists (For example, disable SWT proposal if you are not working on SWT based project)
Avoid too many local history
If version control system is deployed and used properly, a short local history is sufficient is most case.
Close unused View and use correct perspective
Unused perspective take some memory, unused view will take sometime to refresh without any added-value.
Disable unused plugins
This is controversial, as some people reported that, Eclipse load plugin lazily, so disable it doesn't bring too much benefits.

Misc Tips

Apart from the three categories of tips, one more tips looks useful as well:
Keep Eclipse clean without out-dated or broken meta-data
Start eclipse with the parameter:
eclipse -clean
The details for this parameter is can be found Eclipse Wiki, and further explained at EclipseZone.

Reference

Disclaimer

Tips in this post are merely an recap from other peoples. I personally haven't tested all of the tips above (when I try it out latter, I'll keep posting update if the tips is not correct.). As a result, take it at your own risk.

1 comment:

RWT said...

Nice article. I have a question. How do I put Eclipse and JDK on RAM Disk? I am using ImDisk. Do I simply copy jre folder to the ram disk? How do I put Eclipse in ram disk?

Thanks