Re: Compiling packages for the standard distribution with -Os instead of -O2
"Joe Smith" <email@example.com> writes:
> "Rogério Brito" <firstname.lastname@example.org> wrote in message
> Hi there.
> I think that this may be interesting to anybody that has to work with
> computers that are not the latest/more recent as most people in richer
> countries seem to have.
> It seems to be that a good amount of people upgrade their computers in a
> regular basis and, then, don't notice how things can get slower in
> "weaker" computers.
>>Those of us that live in a country where the already installed base of
>>computers is not recent have to live with software that is ever growing
>>in terms of both RAM and CPU cycles and this leaves less computing power
>>for the applications needed to run.
>>One way to mitigate the memory consumption is to, among other things,
>>compile packages with optimization of GCC set to -Os, instead of -O2,
>>which seems to work at least for some programs (the Linux kernel,
>>mozilla-firefox and my own home-grown programs).
> Wait a second. Optimizing for size should decrease speed.
> That is the whole idea of size/speed optimization tradeoffs.
A lot of the time the reduced ram requirement can stop swapping (big
speed increase) and improve the cache hit ratios. That is also a
reason why -O3 isn't neccesarily better than -O2. Optimization can
make things worse too.