Five tips for speeding up Eclipse PDT and Zend Studio

September 8, 2010

Tutorials

Eclipse Helios (3.6) includes an improved version of Eclipse PDT, labeled 2.2. It is also included in the current Zend Studio (7.1 and above). Among other enhancements, it dramatically improved the performance of code lookup-related tasks like searching references, creating a type hierarchy and even code completion. This is due to a new design, inspired by nWire, the real-time code analysis plugin for Eclipse PDT and Zend Studio. This design uses the h2 database engine as a persistent storage for this data.

The h2 database is a high-performance, low profile, Java native database engine, created as a successor to the widely used HSQLDB. It is open source and free to use. nWire uses h2 since its’ early days. We gathered a lot of experience on how to optimize h2 and improve its’ performance. There’s a lot that can be done from the software developer side, however, even as an end user, there’s still some simple techniques you can follow to improve the performance on your machine.

The database files

The h2 engine, as it is used in Eclipse PDT/Zend Studio and nWire, is running from within the Eclipse main process (in embedded mode and not as a server) and keeps the information in local storage, i.e. disk files. As a simple analogy, it is a bit like Microsoft Jet database engine used in MS Access. The database files are kept inside the workspace folder. The location of the workspace folder appears in the title of the main Eclipse window.

Under the workspace, there’s a special folder called .metadata (beginning with a dot). It may be hidden on your machine. This folder contains settings and temporary files for the workspace. The database files are located in:

  • For PDT: <workspace folder>/.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2/
  • For nWire: <workspace folder>/.metadata/.plugins/com.nwiresoftware.nwire.core/ndb/

The database files end with .db suffix. When you work with PDT or nWire, the IO activity around these files is intensive. Keeping the IO smooth is the key to improving your performance. These files can get pretty big. For example, I have a workspace containing the Magento code base with over 5600 PHP files and almost 450K line of code. The PDT repository occupies about 84 MB and the nWire repository is about 1 GB.

1. Disable virus scanners

The first thing you should do is disable virus scanning on database files. This has a major performance impact. The database engine will never execute code stored within the database, so there’s no danger of malicious code being executed. Most virus scanners allow disabling the scan of a given folder (see the folders above) or a given suffix (the .db suffix).

2. Use a fast storage device

Some people use a USB flash drive to store their workspace. Some store their workspace on a network drive. The impact on your performance in these cases will be substantial. If you want to achieve optimal performance, store your workspace on a fast storage device with a fast interface. Use your internal HDD (or SSD) for that purpose. Make sure the drive is properly maintained and has some free space available for the database to grow. If the file system requires it (FAT and NTFS), make sure to defragment your disk periodically.

3. Keep your JVM up to date

Keeping an updated JVM can improve the performance of h2. Especially if your are using an “ancient” version.

4. Delete the database if your experience problems

In some cases, the database may get corrupted. This can happen, for example, in case of a power failure or a crash. When h2 loads the database, it will try to fix the corrupted data, which may take some time, depending on the database size. In case of PDT and nWire, the data is not really worth saving: it can be recreated by analyzing your source code. This means, you can safely delete the database files. Use this technique if Eclipse hangs when starting up or loading nWire. Make sure you close Eclipse first. The database will be recreated when you restart Eclipse.

5. Do not backup the database

If you are using an automated backup solution (e.g. TimeMachine, or a remote backup software), make sure to exclude the database folders from the backup. These files are big and they will change frequently, which means it is a lot of data to back up. As I mentioned above, it is really unnecessary, since the data can be recreated. Needless to say, running the backup while working in Eclipse will seriously affect the IO performance.

Conclusion

Use the above tips to keep PDT and nWire running smoothly. If you have more tips or questions, let us know in the comments. For more information on h2 performance see this page.

8 Responses to “Five tips for speeding up Eclipse PDT and Zend Studio”

  1. chuckrhodes Says:

    I appreciate any tips on speeding up Zend Studio
    <a href="http://therelationshipguide.net">Relationship Guide</a>

  2. christophstrasen Says:

    RAM is cheap these days and ~4GB should suffice for an average workspace. You need to persist your state once in a while though, at least before powering off. I used rsync for that purpose. Gets the job done.

  3. compubomb Says:

    I was using a purchased copy of Zend Studio 7.x not too long ago and I found netbeans to be a better performer than Zend. Just my 2 Cents.

  4. llbbl Says:

    hmm ok maybe I do have JRE installed and updated. It was hiding. So that is not the problem.

  5. llbbl Says:

    Helios has been crashing constantly for me after I add my project files and it is trying to index them. I went back to last year’s version of eclipse PDT (galileo) because at least that works. I do not have a JRE or JDK installed so that may be the problem. If this is now suddenly a REQUIREMENT to run eclipse there is no mention of it on their website.

  6. ultra_blue Says:

    I thought that updating the JVM for Studio wasn’t supported?

  7. baohx2000 Says:

    @ddelrio1986
    A friend of mine had a lot of crashing when using PDT. I had him update the jdk on his system and make sure it was the default and it cleared up the problems.

  8. ddelrio1986 Says:

    Any tip to speed up Eclipse PDT is much appreciated. The newer one has been crashing so much that I’m currently just using gedit.