[ltp] Re: Power saving: self-compiled vs. binary

Daniel Pittman linux-thinkpad@linux-thinkpad.org
Fri, 15 Sep 2006 19:36:36 +1000


"Matthias Redlich" <matthias.redlich@gmx.de> writes:

> in general there are two different package management systems:
>
> * systems like apt/rpm using binary packages 
> * systems like ports in Gentoo where every single package has to be
>   compiled before installation
>
> For sure both systems have their own advantages and I do not want to
> start a new flame-war. The question I am interested in is whether
> there are significant advantages concerning power saving when you
> compile your system from scratch with optimization flags for your CPU
> or not. Has anybody ever measured that? What do you think about that?

I think you are barking up the wrong tree: with the exception of CPU
specific sequences such as "rep; nop" during locking there are almost
no power related options, settings or interactions with the CPU
instruction stream.

Your computer already uses those CPU specific sequences in the
kernel[1], and in all likelyhood so does your C library[2], so you can't
gain anything there.


Finally, that leaves the theoretical benefit that you might run code
faster, so spend more time in idle, and so save power: in that regard,
in almost all cases there is little or no measurable benefit outside
specifically targeted benchmarks to specific compiler options.[3]

So, some things might run faster the system overall performs pretty much
identically.  No difference there, no difference in power saving.


Oh, and one last consideration: don't forget to weigh up the power used
to compile all that optimized code against the power you might save.  

A one percent cut in power consumption probably doesn't save more than
you spent compiling all that code. ;)

Regards,
        Daniel

Footnotes: 
[1]  Even an i386 targeted kernel uses these sequences in the right
     places.

[2]  In some cases installing the 686 version of the C library rather
     than the stock 386 version can improve this a fraction, by enabling
     marginally better optimized instructions for locking.

     This is unlikely to make a measurable difference to performance,
     let alone a perceptible one.  Power management is in the same boat.

[3]  In the cases where this does make a difference binary distributions
     can adopt the same options and see the same benefits -- these are
     almost never micro-architecture specific on x86.

-- 
Digital Infrastructure Solutions -- making IT simple, stable and secure
Phone: 0401 155 707        email: contact@digital-infrastructure.com.au
                 http://digital-infrastructure.com.au/