1 |
Ronan Klyne <rklyne@×××××.com> posted 44F7F407.4090203@×××××.com, |
2 |
excerpted below, on Fri, 01 Sep 2006 09:49:11 +0100: |
3 |
|
4 |
> I'm tempted to use the nice shiny gcc 4.1.1 to build a new kernel - is |
5 |
> this going to make much (or any) difference? |
6 |
> A more general form of the question: does 4.1.1 on amd64 produce faster |
7 |
> binaries, or produce binaries faster? |
8 |
|
9 |
Depending on your optimizations, both in your CFLAGS and whether the |
10 |
sources have been rewritten to take advantage of new 4.x features such as |
11 |
hidden functions in C++, 4.1.1 seems to produce faster binaries, slower. |
12 |
Many of the newer high-level optimizations involve extra runs thru the |
13 |
code, or extra steps during runs that were already there. In some cases |
14 |
these optimizations were already there previously, only they had to be |
15 |
invoked individually where they are now default at some -O level |
16 |
(where previously they weren't tested enough to be default, or were |
17 |
considered too expensive in terms of compile time), other times the |
18 |
optimizations are entirely new or more efficient than they were previously |
19 |
(finding opportunities that were missed before, say). |
20 |
|
21 |
This is the trend in general. Cross-reference the various discussions on |
22 |
LKML (Linux Kernel Mailing List) about dropping support for older |
23 |
compilers, for instance. I think the oldest they support with the latest |
24 |
2.6 kernels is gcc 3.2 (for x86 of course, amd64 support was added in |
25 |
3.3 IIRC, tho there were "hammer patched" 3.2 versions, tho maybe it was |
26 |
3.1/3.2 instead of 3.2/3.3, IDR exactly), but it was 2.95 or there abouts |
27 |
for the longest time, in part because 2.95 was faster at recompiling |
28 |
kernels after tweaking the sources a bit, to just test that the new code |
29 |
worked, so they didn't really care how fast it actually ran in production, |
30 |
thus didn't care about optimizations unless they affected bugs. |
31 |
|
32 |
As for building your kernel with it, again, it could make a difference -- |
33 |
it depends both on your CFLAGS and on some of the choices you made in |
34 |
configuring the kernel. In particular, -Os and the kernel's optimize for |
35 |
size option are likely to be more efficient. A kernel optimized for size |
36 |
may in itself run slightly slower, but being slightly smaller, fits in the |
37 |
cache better, and code runs faster from cache than from main memory. |
38 |
Consider what happens when switching between user space application and |
39 |
kernel context, for example when an app allocates or releases memory, when |
40 |
it talks to the network, or when it checks for and opens files as many |
41 |
applications do hundreds of times while starting up. Smaller code, even |
42 |
tho slower if memory was all the same speed, ends up being faster because |
43 |
more of it fits in fast cache memory, and less ends up being swapped |
44 |
between cache and main memory every time there's a switch between |
45 |
applications or between userspace context and kernel context within an |
46 |
application. |
47 |
|
48 |
-- |
49 |
Duncan - List replies preferred. No HTML msgs. |
50 |
"Every nonfree program has a lord, a master -- |
51 |
and if you use the program, he is your master." Richard Stallman |
52 |
|
53 |
-- |
54 |
gentoo-amd64@g.o mailing list |