[lkml]   [2003]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: gcc -O2 vs gcc -Os performance
In article <263740000.1044563891@[]>,
Martin J. Bligh <> wrote:
>>> All done with gcc-2.95.4 (Debian Woody). These machines (16x NUMA-Q) have
>>> 700MHz P3 Xeons with 2Mb L2 cache ... -Os might fare better on celeron
>>> with a puny cache if someone wants to try that out
>> gcc 3.2 is a lot smarter about -Os and it makes a very big size
>> difference according to the numbers the from the ACPI guys.
>> Im not sure testing with a gcc from the last millenium is useful 8)
>Still no use.
>/me throws gcc-3.2 in the trash can.
>2901299 vmlinux.O2
>2667827 vmlinux.Os

Well, Os is certainly smaller. One thing to look out for is that
microbenchmarks for kernels are usually the _worst_ things to test with

That's since a large part of the premise of the -Os speed advantage is
that it is better for icache (usually not an issue for microbenchmarks)
and that it is better for load/startup times (generally not a huge issue
for kernels, since the real startup costs of kernels tend to be entirely

So I suspect -Os tends to be more appropriate for user-mode code, and
especially code with low repeat rates. Possibly the "low repeat rate"
thing ends up being true of certain kernel subsystems too.

Think of it this way: if you win 10% in size, you're likely to map and
load 10% less code pages at run-time. Which is not a big issue for
traditional data-centric loads, but can be a _huge_ deal for things like
GUI programs etc where there is often more code than data.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:33    [W:0.094 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site