Gentoo Archives: gentoo-performance

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

Replies

Subject Author
Re: [gentoo-performance] inline considered harmful Colin Kingsley <ckingsley@×××××.com>
Re: [gentoo-performance] inline considered harmful "Douglas Breault Jr." <GenKreton@×××××××.net>