18

I develop Android using Eclipse and the ADT plug-in... and it's... slow.

I have to restart frequently and it gets painfully worse when I have various Android projects open (needed for when I use library projects).

Are there any specific optimizations that I can make to improve Eclipse performance when using the ADT plug-in?

hpique
  • 119,096
  • 131
  • 338
  • 476
  • How much RAM do you have? Are you keeping both your java and eclipse up to-date? Personally I use Pulsar http://www.eclipse.org/pulsar/ – Bactos Sep 07 '10 at 01:30
  • Start by using this eclipse.ini settings: http://stackoverflow.com/questions/142357/what-are-the-best-jvm-settings-for-eclipse/3275659#3275659 – VonC Sep 07 '10 at 03:57
  • Though not Android/ADT specific, this might help. http://www.eclipsezone.com/eclipse/forums/t61566.html – Tyler Sep 07 '10 at 06:39
  • @Bactos 4GB. I use the latest Java version (and told Eclipse to use that) and the last ADT supported Eclipse version. – hpique Sep 07 '10 at 07:19
  • @ hgpc: Then I would suggest reading both VonC's link as it shows you how you can Tweak some of the settings. Also MatrixFrog's article is great and I would read that first then go to VonC's. Give as much RAM to your VM as you can and it might help you out. Play around with it and see what works best for your machine. – Bactos Sep 07 '10 at 08:21

2 Answers2

18

First make sure you have a fairly recent version of Java and Eclipse and the ADT plug-ins. Especially Java.

Then close Eclipse and look at the directory where you installed Eclipse. See a file called eclipse.ini there? Make a backup copy, then open it in a text editor. Look at the last few lines. You'll see something similar to the following:

--launcher.XXMaxPermSize
512m
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
-vm
C:/Program Files/Java/jdk1.6.0_24/bin
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms512m
-Xmx2g

Don't worry if it doesn't look exactly like that, and don't change anything except the options I'm about to describe. Each option starts on its own line with no white space.

The important parts for performance are the max permanent generation size option, set with these two lines (that must appear before -vmargs):

--launcher.XXMaxPermSize
512m

I recommend 256m if you have 2g or 4g of real memory, or 512m if you have more. Next, the minimum memory option, set with this line (must appear after -vmargs):

-Xms512m

I recommend this be set to the same thing as your max perm size option. Finally, there's the option that controls the total amount of memory that Eclipse will be able to use, set on this line (must appear after -vmargs):

-Xmx2g

I recommend this be set to 1g if you have 2-4g of real memory, and 2g if you have more.

Save the file and restart Eclipse. You may have to adjust the settings up or down to find the optimum value for your system, but the recommendations above are a good starting point.

Ed Burnette
  • 1,198
  • 8
  • 13
4

Another way to improve Eclipse performance is to buy a solid state drive and use it as your root (C:) device. Install the OS, page files, Java, Eclipse and all your workspaces on it - anything that will be frequently accessed. This makes a huge (3x or more) difference in Eclipse startup and build time compared to a hard disk. It also helps a lot with World of Warcraft. :)

I can say from experience that a quad-core Intel i7 with 64-bit Windows 7, 160GB SSD, and 8GB of memory is plenty fast for Eclipse and Android development today.

Ed Burnette
  • 1,198
  • 8
  • 13