comp.lang.ada
 help / color / mirror / Atom feed
From: Ray Dillinger <bear@sonic.net>
Subject: Re: Compiler Optimisation?
Date: 1998/12/18
Date: 1998-12-18T00:00:00+00:00	[thread overview]
Message-ID: <98-12-042@comp.compilers> (raw)
In-Reply-To: 98-12-024@comp.compilers

Ray Dillinger <bear@sonic.net> wrote:
> > The speed-up due to the peephole stage in my experience runs between
> > ten and twenty percent of overall speed -- Although, of course, it
> > depends on what you put into the "peephole" stage. ...

dewarr@my-dejanews.com wrote:
> This is misleading. Many compilers do MUCH more extensive
> peephole optimization. In particular gcc gets a FAR more
> significant improvement from peephole optimization.

Um.  True.  There are too many ways to interpret what I said.

Okay -- let me be a little more concrete.

Scheme (a LISP dialect), directly translated with optimizations
off, takes about 60 seconds to do something.

After LISP-specific optimizations (redundant-typecheck
elimination and constant folding of procedures) the resulting
code takes about 30 seconds to do something.

This is the rough equivalent of *unoptimized code* in most
imperative languages.

After various algorithmic optimizations such as constant
folding of variables, lifetime analysis, register assignment
analysis, inlining of constant functions, etc, the resulting
code takes about ten seconds to do something.

Finally we get to the peephole stage, and the resulting code
now takes about 5 seconds to run.

Total:  Of my original 60-second runtime, about 55 seconds
has gone away from the scheme program, ten percent or so of
which (5 seconds) was due to the peephole optimization.

But if I hadn't had to do LISP-specific optimizations, I'd
have started with a runtime of about 30 seconds and lost about
25 seconds of it -- about 20% of which (5 seconds) would have
been due to peephole optimization.

And this is what I meant when I said,

"The speed-up due to the peephole stage in my experience
runs between ten and twenty percent of overall speed."

But as dewarr pointed out, the sentence is darned ambiguous,
because I didn't say what I meant by "overall speed", which
is crucial.

In both cases, the code would take about twice as long to run
if no peephole optimizations had been done. In both cases,
it cut about 5 seconds from the total runtime.

				Ray




  reply	other threads:[~1998-12-18  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-06  0:00 Compiler Optimisation? Iain Bate
1998-12-07  0:00 ` Marin David Condic
1998-12-10  0:00 ` Ray Dillinger
1998-12-13  0:00   ` dewarr
1998-12-18  0:00     ` Ray Dillinger [this message]
1998-12-18  0:00     ` Stefan Monnier
1998-12-10  0:00 ` Thomas W. Christopher
1998-12-13  0:00   ` Mike Albaugh
1998-12-13  0:00   ` John F Carr
1998-12-13  0:00 ` Andy Gaynor
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox