I’ve listen enough about green software – or any kind of low-power-consumption software for instance. One says programmers should
carefully look at the object code to minimize transistor state transition – where all the power consumption occurs.
I think this is a bunch of bullshit for two reasons. But first, allow to retort a bit. Low-power-consumption software is applicable in any device that is running on a battery (e.g. your phone), but the concept that’s being taught is completely overstated.
My two reasons:
- processors like the ARM Cortex A8 on your iPhone 4 are superscalar. Which mean that they reorder the instructions in execution time to accelerate the overall program execution. Which makes the argument invalid. Looking at your object code will only be a waste of time.
- there are better ways to reduce power consumption on devices. One of them is reducing the power dissipation in the transistor state transition. (Or maybe using a black-hole as a cooling device
.)
You can argue that it may apply to smaller devices with simpler architectures. Surely I agree, but still who looks at object code these days? Let the compiler do hard work. And how many of the students will really work on these kind of computers? Not many.
Also, in phones the major power consumption doesn’t happen in the processor. The radios (GSM, 3G, GPS, wifi and Bluetooth) and the screen are the greatest wasters. Why focus on bits, when the phone screen alone wastes more than 90% of the phone’s battery? Minimize the time that screen and radios are on, and you will be saving many more watts (and time) than the power saved by perfectly aligned bits.
Another professor says that we should focus in reducing disc spins. There are no discs spins since the invention of flash drives. QED.
The same professor says that reducing the algorithmic complexity of the program will reduce the power consumption. With this I agree. It seems the single improvement in software engineering that will have the largest impact in devices’ power consumption. Reducing an O(n) algorithm to O(log(n)) will reduce the power consumption by one order of magnitude. That’s way more saving than the OCD behavior of aligning bits.
TLDR: carefully looking at bits to reduce power consumption will only work if the processor is not superscalar. Reducing the power consumption on transistors, screens and radios, and reducing the algorithmic complexity of your software are a better way of controlling power consumption, but don’t OCD yourself over this.
If you have arguments against my case, the comment box is at your service