This is the mail archive of the
mailing list for the GCC project.
Re: On inlining in C++
- From: dewar at gnat dot com (Robert Dewar)
- To: aph at redhat dot com, dewar at gnat dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 4 Aug 2003 13:33:18 -0400 (EDT)
- Subject: Re: On inlining in C++
> People are looking at this problem from two different angles:
> a. What will, on average, give the best performance?
> b. What will, on average, cause the least trouble?
Right, those two angles always have to be considered. Note that the decision
in gcc to default to -O0 clearly is more concerned with consideration b than
a. This is probably reasonable, although it often costs gcc in benchmarks
against other compilers where optimization is the default (we have seen
behcnmarking protocols which require the default switches to be used, yes
that's silly, but it happens!)
> "I do not believe that would be a surprise to anyone who thought about
> it for a minute."
You are assuming a model of someone who understands the possible effects
of inlining and knows what an instruction cache is and how it works. The
readership and writership of this list is hardly a representative cross-
section of "in the trenches" C++ programmers, who in my experience have
very little awarness of what is going on at the machine level.