So your Eclipse is sluggish, and you've tried the usual suspects: increase the heap and permgen, run -clean, close projects. You've found all the places where Aptana strangles your install and tried, to the degree possible, to tame its virus-like behavior. But something still feels off. Maybe startup is slow. Maybe, as happened to me, shutdown takes minutes. In my case, my eclipse install got to the point where shutdown was taking 2-3 minutes, and this is on a fairly performant machine. Finally, I had a Popeye moment: "That's all I can stands, I can't stands no more!". I opened up sysinternals excellent Process Monitor utility and watched what was happening. Bottom line: on shutdown eclipse was touching a gazillion different directories in my workspace, even directories on projects that were supposed to be closed. I do not know what it was doing (I suspect Mylyn, though, for what it's worth. But you'd have to rip Mylyn out of my cold, dead hands before I gave it up). So I decided to finally bite the bullet and adopt a practice suggested by many other people over the years (my buddy Mike used to yap at me all the time about this). It's a practice, however, that I tried before but couldn't commit to.
What solved my problems: Separate workspaces. I know, you're thinking, "uh, duh, dumbass. that's what workspaces are for". But hear me out. When you start out with eclipse, you might have 5 or 10 projects in your workspace. A handful of java projects, some CF, some other play-around stuff... whatever. You wanna mess around with AIR, so you have some AIR projects. You have a handful of Flex projects. You decide one day to monkey with CFEclipse b/c you're so keen on giving back to the community, so you check out the 6 or so projects from SVN. You create a couple eclipse plugins yourself. Soon enough, you end up with 50 projects in your workspace. But you keep most of them closed, so technically they should be closed, right? "Yer dead to me", right? Apparently not. So I got my act together and finally separated out my different types of work into different workspaces, and the difference is dramatic. My primary workspace -- whittled down to a mere 31 projects -- starts up and shuts down in seconds. All the other workspaces, ranging from maybe 6 projects to 20 projects, load just as quickly. Nice thing is that now that I've got projects separated out, I don't need to keep projects closed all the time -- at least, not the ones in my "secondary" workspaces.
How to move projects from one workspace to another
But this post isn't just about my dummy AHA! moment. It's about a tip for a really fast way to move projects out of one workspace and into another. Here's what to do: To create a new workspace: Simply go to File -- Switch Workspaces and then type in a new Location. For example, for a workspace containing my Flex stuff, I just typed in c:\documents.....\mesher\EclipseWorkspaces\MyFlexWorkspace. Eclipse will then create a new, empty workspace. To get some of your existing projects into the new workspace:
- File -- Import
- General -- Existing Projects into Workspace
- Click "next"
Here's where it might get a bit tricky, so I'm going to go into all the detail for my own personal setup. I have projects scattered throughout my system, but largely they fall into two places: 1) my webroot where I keep all my cf projects, and 2) my actual workspace, where I keep most of my java projects. I'll start with my CF projects. Let's say I have 50 different projects underneath my webroot, and I wanted to break them into roughly a third. In the "Select Root Directory" dialog that comes up, I went to c:\inetpub\wwwroot. This brought up a ton of projects, only a third of which I wanted to move into my new workspace. It then scans for all projects and loads them into the window at the bottom of the panel. I clicked "deselect all", then selected just the projects I wanted to import. Then, I clicked Finish. That brought all the projects I wanted to import into my new workspace. NOTE: I did NOT click to "copy projects into workspace!". I repeated that step for the other projects I wanted to move into separate workspaces. Finally, I went into my primary workspace selected the projects that I had moved into separate workspaces, and deleted them. I did not select "remove from file system"! Remember... by moving projects to another workspace, you're not physically moving the location on the file system.
One thing to note when creating new workspaces is that each workspace gets its own separate Preferences. This is a good thing! But it does create a bit of extra work if you simply want to replicate your preferences among the various workspaces. For me, the quickest way to move my preferences from the primary workspace from the secondary workspaces was this:
- in primary workspace, go to File -- Export
- filter on "preferences"
- Export all preferences to a file somewhere... I put mine on my desktop
- in this secondary workspace, go to File -- Import
- Filter on "preferences"
- Navigate to the file you created
- Click Finish
Run and debug your Android™ applications directly on a device. Modify and rebuild the Android operating system, and flash it onto a phone. The Android Dev Phone 1 is carrier independent, and available for purchase by any developer registered with Android Market™. Price: $399 USD
This is all well and good... turn the PC off, and save some money and some trees. But that's not good enough. I want it to be brainless... I don't want to have to turn off anything, and I don't want to have to wait a few minutes for everything to boot back up. I want it to happen automatically, and have my entire "state" retained when it comes back up. So, on to Part II of how I'm saving the world. "Sleep" to the rescue. Now, back in the XP days, I remember sleep flat out sucked. It took forever to come back up, often longer than it would've taken to shut down and restart the PC. With Vista -- at least in my experience with this particular PC, sleep is quite good. I have my power options set to turn off the monitors after 5 minutes of inactivity and Sleep the computer after 10 minutes. Thus, 10 minutes after I walk away from the thing, my state is retained and everything "shuts down". All earth-melting peripherals are off the grid. Angels weep at my magnanimousness. Babes swooooon. Now, some latte-sipping hypermiler choad is saying "But that's 10 minutes! What about the Northern endangered spotted Newt! You're killing the Newt you paint-drinking techno-earthkiller!". OK, I'll grant that in those 10 minutes, multiplied by say 10 times a day or whatever, I'm not winning any Al Gore Humanitarian awards. So, on to Part III, for the Prius set. In Vista, you can control what the "power" button does. That's the little round thing with the bar up the middle. I have it set so that when I hit the power button, the computer goes to "sleep". This is not windows XP sleep. This is Vista sleep (again, at least on my PC). And it shuts down within about 5 seconds, and when I wake it back up with a single mouse click, it's ready to roll in about 5 seconds. Full network connectivity takes somewhere between 15 and 30 seconds to reestablish. I know it's back up when TweetDeck chirps. Now, I did hit a snag initially with keeping the router Hot. The PC would sleep, but then it'd come back to life a second or two later. I had to go into device manager, find the network controller, right click and select "Properties", go to the "Power Management" tab, and Deselect "Allow this device to wake the computer". Bottom line: for me, the Smart Strip + Vista + Power Options + Sleep-on-Power-Button combination has been a win.