tags:

views:

409

answers:

4

I often find myself wanting to open Xcode and do a little coding on international flights and while I'm away from power, but it's a quick way to empty my MacBook Pro's battery.

What settings do you use to preserve battery life while running Xcode?

+2  A: 

My guess would be that XCode's predictive compilation (which compiles as you type to shorten build times later on) would be a big draw, as well as indexing. You can turn them both off in Preferences, under "Building" and "Code Sense," respectively.

Some light testing, though, seems to show that it doesn't do predictive compilation if you're on battery. So, maybe that's not a problem. Indexing still might help, if you can stand it being off.

It would probably also help to do as little work as possible while compiling - maybe check to make sure you're using precompiled headers with all the large frameworks you're importing.

Jesse Rusak
A: 

How about changing the editing window to have light text on a dark background.

There are predefined settings in the preferences under fonts and colours.

Abizern
The LCD screen uses MORE energy to display the black color than the white color, but the difference is small anyway.
Alexandre L Telles
Not by much, and you can turn down the brightness a lot more without straining your eyes.
Abizern
+4  A: 

Predictive compilation automatically disables itself when running on battery.

If you have a dual-core machine,

defaults write com.apple.Xcode XCMaxNumberOfDistributedTasks 1

compiles one file at a time (instead of one on each core of your dual-core CPU) which may result in some savings.

cdespinosa
A: 

I found that the best way to save battery on my mac is to reverse all the colors using universal access. Everything looks in negative, but if you can tolerate that, your screen would be mostly black and I am fairly convinced that it makes a difference.

Other than that, check if you can shut down one of the cores, I do that often on my mac pro.

Note: I am well aware that in LCDs, there is very little power difference between white and black pixels. However, in my own limited experience, I can reduce contrast and brightness when working against a black background than I can against a white background, and that does produce a power saving.

Uri
See my comment on Abizern answer.
Alexandre L Telles
My understanding is that in LCDs, there is only about 6% difference (probably in favour of white). However, when working in inverse colors, one needs less contrast and brightness.
Uri