« Scraps of JavaScript | Main | PGP for Mac Mail »

Invasion of the Battery-Life Snatchers

Listen to this articleListen to this article

Over the past 6-9 months, I've been doing a lot of development using my PowerBook running on battery. For the most part it works really well: The performance is just fine (with some tweaking of the power-saving settings), giving me around 2 hours of editing, browsing, emailing, etc. That is unless I'm developing code using IntelliJ.

When running in the foreground, IntelliJ seems to use anywhere between 3.0% and 6.0% of the CPU. Not too bad you might think but that is when I'm not doing anything with it. Even when IntelliJ is in the background -- either hidden or minimized -- it still uses around 3.0% of the CPU as this screen-shot from top clearly shows:

     PID COMMAND      %CPU   TIME   #TH #PRTS #MREGS RPRVT  RSHRD  RSIZE  VSIZE
    1259 top         14.5%  0:29.70   1    18    22   776K   372K  2.62M  26.9M 
-->  670 idea         2.7% 11:11.22  26   >>>   485   270M  28.3M   231M   831M <--
    1248 Safari       0.2%  0:06.22   6   127   238  8.89M  27.9M  18.8M   243M 
    1247 SyncServer   0.0%  0:03.65   2    53    48  12.2M  3.36M  15.1M  47.3M
    1225 mdimport     0.0%  0:01.11   4    66    67  1.39M  3.27M  5.16M  39.7M
     668 bash         0.0%  0:00.02   1    14    17   220K   820K   904K  27.1M

A quick check of the Java version indicates that I am running JDK 1.5 by default:

simon$ java -version
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-56)
Java HotSpot(TM) Client VM (build 1.5.0_02-36, mixed mode, sharing)

And a quick check of the About Box in IntelliJ confirms this.

Now admittedly I haven't tried any other Java applications so I'm not too sure if it's a Java issue, a Java on OS X issue, an IntelliJ issue or what but it is driving me nuts because it pretty much turns my 2+ hours of battery life into 30-45 minutes.

So if anyone has any idea how I might get IntelliJ to stop using CPU when it's idle, please, please, please let me know.

Oh and Jeaves, "use Eclipse" and "get a real computer" will not be considered helpful answers ;-)

Update (30 August 2005): Vote for the bug.

Comments

It's not an OS X/Java problem; Eclipse doesn't do this, nor do my Swing apps.

I have a few apps, Java and otherwise, that handle their event processing incorrectly, polling when they shouldn't. Word from Office vX is a good example; it eats 2-3% of my CPU at all times. IntelliJ may be doing the same.

DOH! Guess I'll have to point the finger at IntelliJ then. That'll be harder to get a "fix" for I imagine but I'll give it a go.

Thanks for the feedback anyway.

I agree with Cliff. I use eclipse on my iBook on the train each day (30-40 minutes each way) and would be unlikely to ever use more than 30% of my battery during that time.

(I am however using JDK1.4 since I haven't shelled out for OSX.4 yet)

How much RAM does an ibook need to make a decent developer environment?

Interesting question. I'm not sure what the differences are between an iBook and a PowerBook but nevertheless, on my machine--a PowerBook--I run with 2GB of RAM and, according to top, have around 1GB free while running: IntelliJ; 6+ Safari windows/tabs; Mail; and 3+ terminal sessions.

My iBook has 768Mb of RAM and performs quite well. This morning with Eclipse, Vim, Terminal and Firefox all open (but not doing too much) it was using about half the RAM.

So, "use Eclipse" seems to be the answer ;-)

In the famous words of Mutley: russen fussen... :-)

It's a known issue, which will be fixed in the next bugfix release of IntelliJ IDEA (version 5.0.2). This version will be released in a couple of weeks. Keep on using of IntelliJ IDEA :-)

Ilia,

We're now at release-candidate 2 and I don't see this being fixed. Can I still assume it will be fixed?

Well it looks like Build #3452 (5.0.2 RC3) brings the CPU usage down to 0.3%! Yay!

My battery thanks the JetBrains guys (and my girflfriend want's to know where you live ;-)

Post a comment