It seems logical to me that on a 64-bit kernel compiling it to optimize for size might help overall. (My distro of choice uses -O2) It has the benefits of more registers and memory and perhaps less cache contention than normal optimized code. I have a kernel compiled like this and it seems excellent. However my question is how can I prove this? I like using Phoronix for "real world" sort of benchmarks so I would prefer to test cases like that. What should I pick to test? Does anyone else have any alternatives? Thank you very much in advance.

  • Well if any one is curious the built in 7zip benchmark showed that -Os was slower, but I am not discouraged. It was even or higher in other ones. – NightwishFan Jan 16 '11 at 17:48

If your -Os compiled kernel "seems excellent" I think you shouldn't care benchmarking it, here is why:

The problem with benchmarks will always be to choose what types of loads you test.
Even if Phoronix Test Suite is fine to highlight differences between different kernel revisions you can't use it yourself to prove your kernel performs better for your own load because you don't ask it the same operations on a day to day basis.

In case you still want to try this:
Maybe you could try benchmarking the applications you're using most of the time or those who takes a long time to complete (3D rendering/compilations/OLAP-style queries aka cubes/rainbow tables generation...) to see if you can find a gain.

I personally highly doubt you'll see any real (measurable, repeatable) speedup with -Os on a modern desktop CPU (embedded CPU can gain some performances though). The little more aggressive optimizations with -O2 (source article) might be more interesting than the smallest size of the -Os kernel.

this chart

If you need more infos/wants to talk about gcc optimizations more thoroughly you can go on the #gentoo channel on freenode IRC or on the gentoo forums, but remember: just don't mention the term "ricer" ^^

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.