How to benchmark kernel (-Os vs -O2)

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.


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" ^^