From: firth@sei.cmu.edu (Robert Firth)
Subject: Re: Use pragma INLINE or not?
Date: 27 Jun 91 16:13:50 GMT [thread overview]
Message-ID: <27847@as0c.sei.cmu.edu> (raw)
In-Reply-To: 1991Jun19.234429.20796@netcom.COM
In article <1991Jun19.234429.20796@netcom.COM> jls@netcom.COM (Jim Showalter) writes:
>Let the compiler inline when it can figure it out. Use a profiler
>to find bottlenecks when tuning the code, and manually inline the
>offenders. DON'T inline everything to "be sure"--this has a bunch
>of bad effects, and is completely unecessary (10% of your code uses
>90% of your CPU).
Ah, how true! I remember writing my very first execution profiler,
for a machine that didn't have one. To test it, I profiled a pretty
substantial program that I'd writen myself, maintained for a few
years, and with which I believed myself reasonably - nay, intimitely
- familiar.
Well, before profiling, I marked my guess at the top few time
sinks - obvious things such as the chain of 6 nested procedure
calls it took to emit one byte of output data.
All my guesses together accounted for 6% of the time. The number
one time sink was a search loop that I'd stupidly written the wrong
way round - the item being looked for was usually near the end of
the list rather than near the beginning. Who would have believed
that mattered for a list of maximum length 18? I reversed the
search and saved almost 20% of the time.
next prev parent reply other threads:[~1991-06-27 16:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
1991-06-18 17:14 Use pragma INLINE or not? Fred Stluka
1991-06-19 8:58 ` Orville R. Weyrich
1991-06-19 15:15 ` Robert I. Eachus
1991-06-19 15:57 ` Brian Hanafee
1991-06-19 21:51 ` George C. Harrison, Norfolk State University
1991-06-19 23:44 ` Jim Showalter
1991-06-27 16:13 ` Robert Firth [this message]
1991-06-27 21:00 ` Michael Feldman
1991-06-28 12:39 ` Kenneth B. Hawks
1991-06-28 17:56 ` Lance E Murray
1991-06-28 15:09 ` Use pragma INLINE or not? (SUMMARY) Fred Stluka
-- strict thread matches above, loose matches on Subject: below --
1991-06-20 13:07 Use pragma INLINE or not? Bevin Brett
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox