I am writing a Android phone application that needs to be very power efficient, and I would like to use the most power efficient sorting algorithm. I will implement it in C for extra power efficiency. What algorithm is the most power efficient algorithm for sorting arbitrary text strings?
3 Answers
As concluded by this paper, the algorithm with the better asymptotic run time seems to also have the better energy efficiency, which corroborates the assumption that an algorithm with a higher performance also has a higher energy efficiency.
Smaller runtime is not all. In Evaluating Algorithms according to their Energy Consumption (Computability in Europe, 2009), Fudeus née Bayer and Nebel show that an algorithm with more executed instructions (this is typically analysed, at least in theory) might use less energy¹.
Keep in mind that energy consumption is determined by at least
- the algorithm itself,
- the compiler,
- the CPU and
- the hardware memory management.
One particular effect is that the energy consumption of modern CPUs is not just the sum of fixed contributions of all statements. The sequence is relevant, that is an addition may have different cost depending on whether it is executed after a jump or a subtraction. Hence, for example
- instruction reordering by the compiler can have effects in all directions on energy consumption, depending on the target system, and
- fewer operations cost more because e.g. the ALU is shut down in between operations and is costly to start up again.
- It might also be faster, mind.
The sort benchmark website has a category on energy efficient sorting. Currently, NTOSort and Tritonsort seem to be the best.
- 5,991
- 19
- 27