Gentoo Archives: gentoo-performance

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

Replies

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