How to Speed Up Eclipse in a Few Clicks
Eclipse is the market leading IDE of choice for Java developers. It’s a rich featured IDE which makes developing code in Java super simple. However, we’ve all at some point said or thought to ourselves, “Wow, my Eclipse is slow today, what’s it doing?”. To be honest, it might be working on a bunch of tasks that event the Eclipse foundation aren’t sure about, but some of which we can explain to you, and eliminate for you so that your Eclipse can run faster, just like when you first unwrapped it.
Learn how to add custom install actions to Eclipse IDE in another blog post here.
How Can I Make Eclipse Run Faster?
Here are the topics which are the typical culprits when working out what might be slow on your Eclipse environment.
- Insufficient memory allocation
- Class verification overhead
- Excessive indexes and history
- Obsolete or slow JDK
- Eclipse being out of date
- Lengthy build and redeploy times
Each of these areas can afflict different amounts of pain to different developers, based on how long you’ve used the installation for, your type and number of projects. Let’s go through each one individually and show you how you can fix them. Remember, your milage may vary.
Insufficient Memory Allocation
This might seem obvious, but Java applications are rarely tuned with reasonable Java memory settings from the outset and you’d be well advised to change yours to reduce constant heap expansion which really slows general startup and running down. Your settings will of course depend on your detailed environment, but here are some suggested settings which will give you a much more performant environment from the outset:
-server -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+UseParallelGC -Xms512m -Xmx1024m
There’s also a
+UseParallelGC flag used to dictate which garbage collector strategy to use. This strategy minimises the garbage collection pause, meaning the time spent garbage collecting is reduced as much as possible.
Class Verification Overhead
Class verification is where the JVM sifts through your class files when they’re loaded and verifies that class data is not corrupt or invalid. This is only really important if you’re manipulating byte code anyway. Plugins also go through the same checks and this can be a big overhead. We’re talking 10-20% startup improvement.
So how can you fix it? Well, you need to use the
-Xverify:none option on your JVM, which disables class verification.
Excessive Indexes and History
I remember being at school, sitting in my history class thinking... Wow, this is incredibly boring. Well, Eclipse history is just as boring, and it has the same effect too. It manages to make time feel longer than it actually is. Eclipse stores a bunch of info in indexes and history which build up over time. It stores them in two directories as follows:
Eclipse spends a lot of time going through these files and if you have excessive build up in these directories, you could be experiencing a lot of churn around start up and general running. It’s important to clean up your history and indexes periodically.
Obsolete or Slow JDK
The latest version of Java available today is version 8. You know that right? Thought so, just checking. Big performance improvements are made in each version of Java when new versions are released and it just makes sense to upgrade, if possible. Of the available (non-beta) Java releases out today, the Oracle JDK looks to be the most performant and so is recommended for use with Eclipse.
Eclipse Being out of Date
There are a number of reasons why being on a recent version of Eclipse is important. Firstly, and least importantly, it’s super shiny and you’ll make all your friends and colleagues feel jealous and old fashioned when they realise their Eclipse version isn’t named after a popular chocolate bar. Secondly and more importantly, the Eclipse foundation do put a lot of work in to make Eclipse more performant, so you may as well make use of these enhancements in the newer versions.
Plugins tend to be written and updated for the more recent versions, so you’ll soon potentially find yourself in a poorly performing environment, and remember, not all plugin updates will even support a lot of the older versions of Eclipse. Obviously, if you’re running and stuck on a legacy plugin which you depend on, and it doesn’t support a newer version of Eclipse, this may not be an option for you, but this is quite rare.
Lengthy Build and Redeploy Times
We of course know that one of the major pain points when developing applications in Java is having to build, compile, package, restart/redeploy, generate state, ZZzzzzz. And all this before you can even think about testing or seeing your code changes.
Well, there’s no need to worry or grow old beyond your years as there is a solution. It wears a cape, and goes by the name of JRebel. A tool which has a deep integration with Java Classloaders, application servers and Java frameworks that allow you to instantly reload your code changes!
You can learn more about the tool on the JRebel product pages, and install directly through the marketplace. (*Note* JRebel does of course work on all the other major IDEs too!)
Looking for additional reading on Eclipse and other Java IDEs? Be sure to check out these resources for added insights: