Gentoo Archives: gentoo-performance

From: "Douglas Breault Jr." <GenKreton@×××××××.net>
To: gentoo-performance@l.g.o
Subject: Re: [gentoo-performance] inline considered harmful
Date: Thu, 22 Jul 2004 01:17:51
Message-Id: 20040721211643.1a698304.GenKreton@comcast.net
In Reply to: Re: [gentoo-performance] inline considered harmful by Adam Petaccia
1 You could just enable -O2 and the following: -frename-registers and -fweb. -O3 is simply -O2 plus those 3 options.
2
3 On Wed, 21 Jul 2004 20:50:01 -0400
4 Adam Petaccia <adam@×××××××××.com> wrote:
5
6 > With gcc, is there a way to enable all -O3 options but function
7 > inlines? Would -fno-inline work or something like that?
8 >
9 > Mario Domenech Goulart wrote:
10 >
11 > >Hello,
12 > >
13 > >There's an interesting discussion in the OpenBSD mailing
14 > >list about the use of inline.
15 > >
16 > >Here's the beginning of the thread about this topic:
17 > >
18 > >,----[ http://www.sigmasoft.com/cgi-bin/wilma_hiliter/openbsd-tech/200407/msg00175.html ]
19 > >| inline considered harmful.
20 > >|
21 > >| * To: tech@×××××××.org
22 > >| * Subject: inline considered harmful.
23 > >| * From: Artur Grabowski <art@××××××××.org>
24 > >| * Date: 21 Jul 2004 03:54:46 +0200
25 > >| * User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2
26 > >|
27 > >| Today we did a bunch of removal of inline functions in the kernel.
28 > >| It all started to make floppies fit, but now it's a quest.
29 > >|
30 > >| If you think that I'm crazy doing this because it might hurt your
31 > >| precious performance, go back to your vax and leave the performance
32 > >| tuning to people who have a cache.
33 > >|
34 > >| Every single inline we removed today (and there are more in the
35 > >| pipeline and even more waiting to be fixed) shrunk the code and MADE
36 > >| IT FASTER. Yes, modern cpus have something called "cache". The cache
37 > >| prefers the code to be smaller, rather than free from function calls.
38 > >| Yes, some cpus have expensive function call overhead. Don't use them.
39 > >| i386 has quite expensive function calls, on the other hand it doesn't
40 > >| have any relevant amount of registers either. So a function call
41 > >| instead of the same function inlined can potentially make the job
42 > >| easier for the register allocator in the compiler which could eat the
43 > >| overhead. At the same time the instruction cache can run the same code
44 > >| in the same place, instead of loading it from main memory 4711 times.
45 > >| And guess what? The stack on i386 is in the cache too, so the function
46 > >| call overhead isn't that bad anyway.
47 > >|
48 > >| I'm tired of seeing code where everything is made inline just because
49 > >| someone acted on a meme that hasn't been true for over a decade. Bloat,
50 > >| bloat and more bloat. Since people can't use inline correctly (it does
51 > >| have valid and correct uses), from now on inline in the OpenBSD kernel
52 > >| is considered to be a bug until proven otherwise. So. Next time I see
53 > >| code that adds to the bloat with inlines, I expect performance figures
54 > >| and kernel size comparisons that show that the inline actually
55 > >| contributes anything. Otherwise the code does not go in.
56 > >|
57 > >| There's still a lot of work to be done in the kernel (yes, macros can
58 > >| be evil too, just see nfs), so send diffs. And there's a whole
59 > >| unexplored field in userland too.
60 > >|
61 > >| //art
62 > >`----
63 > >
64 > >Mario
65 > >
66 > >
67 > >--
68 > >gentoo-performance@g.o mailing list
69 > >
70 > >
71 > >
72 > >
73 >
74 > --
75 > gentoo-performance@g.o mailing list
76 >

Replies

Subject Author
Re: [gentoo-performance] inline considered harmful Colin Kingsley <ckingsley@×××××.com>