This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -fobey-inline (was Re: gcc and inlining)


> Well, you'd assume the person who adds "inline" has done measurements or
> looked at the generated assembly.

I think you would be entirely wrong. Certainly in Ada, I can promise you
that (this is looking at 20 years of extensive experience with the use
of pragma Inline) most Ada programmers don't know enough to look at the
assembly language, and very few have done measurements. Actually the task
of doing measurements on a function by function basis is virtually
impossible, since the choices interact, so if you have K functions
that are possible candidates you would have to do 2**K measurements.

Even programmers who do know assembly language really well (I am one, I have
written hundreds of thousands of lines of commercially delivered assembly)
find it harder and harder to look at an assembly listing and have a good
idea of how fast things will run. The behavior of modern processors with
multiple pipelines where dozens of instructions can be in-flight and
branch prediction algorithms are both complex and critical, can be extremely
difficult to understand accurately. The old days when each instruction
took bla time and you added bla+bla+... to get the execution time for
a sequence of instructions are long long gone.

In practice the decision to use pragma Inline is based most typically
on an assumption that the function is small, because the source is
small and simple, and a knowledge that it is called frequently.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]