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