comp.lang.ada
 help / color / mirror / Atom feed
From: Tim Behrendsen <tim@airshields.com>
Subject: Re: C is 'better' than Ada because...
Date: 1996/08/02
Date: 1996-08-02T00:00:00+00:00	[thread overview]
Message-ID: <Pine.A32.3.91.960802092803.31160B-100000@wc.airshields.com> (raw)
In-Reply-To: 9608020139.AA29105@pulsar.telesoft


On Thu, 1 Aug 1996, Keith Thompson wrote:

> In comp.lang.ada you write:
> 
> I don't believe C's expression syntax or close-to-the-metal pointers are
> particularly good for optimization.  They're good for making it easy to
> do straightforward compilation, and allowing source-level optimization.
> This made a lot of sense back when C was first developed.
> 
> An optimizing compiler typically has to build up some fairly high-level
> information about the structure of the program.  It then analyzes this
> structure, rearranges it for greater speed and/or smaller code size,
> and generates executable code (or assembly language, or whatever).
> If the language uses a lot of very low-level constructs, the compiler
> has to synthesize the higher-level information.
> 
> [interesting optimization examples snipped for brevity]

Unfortunately, it's very difficult to find good examples of things
that are difficult to optimize, because a case can always be made
for a specific optimization.  In my experience, optimizers are usually
strong in some areas, and weak in others.  Unfortunately, every one
is weak/strong in different areas.

Let me try this from a different direction.  Let's say I have the
theoretically perfect optimizer.  The perfect optimizer is capable of
taking HLL code and producing the absolute most efficient translation to
assembly.  It is not capable of improving the algorithms, of course;
a O(n^2) algoirthm is not going to improve to O(n).

Now, if I have a perfect optimizer I should be able to arrange my
code in *any* algorithmically valid sequence, and it will still produce
the same code by definition.  In fact, I should be able to toss in
red-herring code and it will drop out because it adds nothing to
the algorithm.

OK ... back to the real world.  We know that this isn't the case, and
we have to use *some* responsibility when coding our programs to not
doing something so boneheaded that the optimizer can't save us.

So, here's the question, then.  Where is the middle ground?  Given that
optimizers do not approach the ideal, how does a programmer know what's
going to be optimized efficiently, and what isn't?  I submit that it's
valuable to for a language to be capable of structuring the syntax such
that the optimizer can do straightforward job on it.

The thing about C is that the syntax is so loose and fast, naively coded
subroutines can defeat the optimizer just from the side effects.  How
about this; I'm just thinking off the top of my head, but perhaps there
is a "range of optimization" for a language.  Given a language, the
syntax has a certain range of flexibility.  For the C language, it is
extremely flexible in the number of ways something can be coded.  This
produces a wide range of optimization efficiency.

Would it be fair to say that Ada has less structural flexibility, but
you gain more consistency in optimization?  If this were true, then
it could be said that a carefully programmed C program could potentially
be faster, but the skill level required for the average optimization
efficiency for C is much higher than Ada (or another more rigid language).

The above is off the top of my head; does any of that make any sense?







  parent reply	other threads:[~1996-08-02  0:00 UTC|newest]

Thread overview: 272+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-19  0:00 C is 'better' than Ada because Alan Brain
1996-06-20  0:00 ` Ron Thompson
1996-06-22  0:00 ` Nasser Abbasi
1996-06-22  0:00   ` David Morton
1996-06-22  0:00     ` Robert Dewar
1996-06-23  0:00       ` The Deviant
1996-06-23  0:00         ` Michael Feldman
1996-06-23  0:00         ` John Winters
1996-06-23  0:00         ` Robert Dewar
1996-06-24  0:00         ` token%/etc/HOSTNAME
1996-06-23  0:00     ` John Winters
1996-06-23  0:00       ` David Morton
1996-06-23  0:00         ` Lawrence Kirby
1996-06-27  0:00           ` ) OH NO "...begs the question..." Ralph Silverman
1996-06-28  0:00             ` Bill Wendling
1996-06-23  0:00         ` C is 'better' than Ada because John Winters
1996-06-23  0:00           ` David Morton
1996-06-30  0:00   ` Nasser Abbasi
1996-06-23  0:00 ` Nasser Abbasi
1996-06-23  0:00   ` Fergus Henderson
1996-06-23  0:00     ` Robert Dewar
1996-06-28  0:00       ` Fergus Henderson
1996-06-29  0:00 ` Kevin D. Quitt
1996-06-29  0:00   ` Robert Dewar
1996-06-30  0:00   ` Fergus Henderson
1996-07-01  0:00     ` Mike Roske
1996-07-01  0:00       ` Robert Dewar
1996-07-02  0:00       ` Ken Garlington
1996-07-03  0:00     ` Kevin D. Quitt
1996-07-04  0:00       ` Ian Ward
1996-07-05  0:00         ` Peter Amey
1996-07-05  0:00           ` Robert Dewar
1996-07-10  0:00             ` James A. Squire
1996-07-15  0:00               ` Oliver Kellogg
1996-07-16  0:00                 ` Oliver Kellogg
1996-07-18  0:00                   ` Fraser Wilson
1996-07-18  0:00                     ` Fergus Henderson
1996-07-19  0:00                   ` Keith Thompson
1996-07-17  0:00                 ` Robert Dewar
1996-07-11  0:00             ` James A. Squire
1996-07-16  0:00             ` Nasser Abbasi
1996-07-16  0:00               ` Mark A Biggar
1996-07-17  0:00             ` Laurent Guerby
1996-07-17  0:00               ` David Emery
1996-07-17  0:00             ` James A. Squire
1996-07-18  0:00             ` James A. Squire
1996-07-07  0:00           ` Kevin D. Quitt
1996-07-08  0:00             ` Ian Ward
1996-07-18  0:00               ` Hamilton Link
1996-07-19  0:00                 ` Kevin D. Quitt
1996-07-08  0:00             ` Robert Dewar
1996-07-10  0:00               ` Peter Hermann
1996-07-15  0:00                 ` Tim McGuire
1996-07-16  0:00                   ` Kevin D. Quitt
1996-07-16  0:00                     ` Robert Dewar
1996-07-18  0:00                     ` Bob Gilbert
1996-07-19  0:00                       ` Kevin D. Quitt
1996-07-18  0:00                     ` Ken Garlington
1996-07-19  0:00                       ` Kevin D. Quitt
1996-07-19  0:00                         ` Richard O'Rourke
1996-07-22  0:00                           ` Kevin D. Quitt
1996-07-22  0:00                             ` Robert Dewar
1996-07-23  0:00                               ` Tim Behrendsen
1996-07-24  0:00                                 ` Theodore E. Dennison
1996-07-27  0:00                                   ` Tim Behrendsen
1996-07-29  0:00                                     ` Dirk Dickmanns
1996-07-30  0:00                                       ` Tim Behrendsen
1996-07-31  0:00                                         ` whiting_ms@corning.com (Matt Whiting)
1996-07-31  0:00                                         ` Dirk Dickmanns
1996-07-31  0:00                                           ` Kevin D. Quitt
1996-08-01  0:00                                             ` Alan Brain
1996-08-02  0:00                                               ` Kevin D. Quitt
1996-08-05  0:00                                                 ` Byron B. Kauffman
1996-08-15  0:00                                               ` Mike Roske
1996-08-15  0:00                                                 ` David Shochat
1996-08-16  0:00                                                   ` Ken Garlington
1996-08-16  0:00                                                 ` John Herro
1996-08-16  0:00                                                   ` John Herro
1996-08-16  0:00                                                 ` Jon S Anthony
1996-08-05  0:00                                             ` Robb Nebbe
1996-08-02  0:00                                           ` Dirk Dickmanns
1996-07-29  0:00                                     ` Bob Kitzberger
1996-07-30  0:00                                       ` Tim Behrendsen
1996-07-30  0:00                                         ` Richard A. O'Keefe
1996-07-30  0:00                                           ` Tim Behrendsen
1996-07-30  0:00                                         ` Theodore E. Dennison
1996-07-29  0:00                                     ` Ada is 'better' than C because John Herro
1996-07-30  0:00                                       ` Brian Rogoff
1996-07-30  0:00                                         ` Adam Beneschan
1996-07-31  0:00                                         ` Franz Kruse
1996-08-04  0:00                                       ` Richard Riehle
1996-08-05  0:00                                         ` Sandy McPherson
1996-08-06  0:00                                           ` Ken Garlington
1996-08-06  0:00                                             ` GAFFNEY.BRIAN
1996-08-07  0:00                                               ` Ken Garlington
1996-08-08  0:00                                             ` Theodore E. Dennison
1996-08-08  0:00                                               ` Frank Lipski
1996-08-09  0:00                                             ` Sandy McPherson
1996-08-15  0:00                                             ` Mike Stark
1996-08-07  0:00                                           ` Bob Kitzberger
1996-08-08  0:00                                           ` Robert Dewar
1996-08-08  0:00                                             ` Kevin D. Quitt
1996-07-30  0:00                                     ` C is 'better' than Ada because Theodore E. Dennison
1996-08-08  0:00                                     ` Ada is 'better' than C because William Clodius
1996-08-09  0:00                                       ` Kevin D. Quitt
1996-08-09  0:00                                       ` Robert Dewar
1996-08-12  0:00                                       ` OBryan Anthony H
1996-08-12  0:00                                         ` Bob Kurtz
1996-08-12  0:00                                         ` Lawrence Kirby
1996-08-13  0:00                                         ` Tom Watson
1996-08-14  0:00                                         ` Robert Dewar
1996-07-29  0:00                                   ` C is 'better' than Ada because system
1996-07-30  0:00                                     ` Tim Behrendsen
1996-07-24  0:00                                 ` Dirk Dickmanns
1996-07-24  0:00                                 ` JamesS1889
1996-07-25  0:00                                 ` Alan Brain
1996-07-23  0:00                               ` Theodore E. Dennison
1996-07-23  0:00                               ` Kevin D. Quitt
1996-07-24  0:00                                 ` Theodore E. Dennison
1996-07-24  0:00                                   ` Kevin D. Quitt
1996-07-25  0:00                                     ` Alan Brain
1996-07-25  0:00                                     ` Steve Howard
1996-07-27  0:00                                     ` Bob Kitzberger
1996-07-26  0:00                                   ` Mike Roske
1996-07-25  0:00                                 ` Fergus Henderson
1996-07-25  0:00                                   ` Kevin D. Quitt
1996-07-26  0:00                                     ` kennedy1
1996-07-26  0:00                                     ` Fergus Henderson
1996-07-10  0:00               ` John F. Bode
1996-07-11  0:00                 ` Mike Roske
     [not found]               ` <4rvr2j$2gb0@info4.rus.uni-s <nhn30yhw6t.fsf@paralysys>
1996-07-18  0:00                 ` Kevin D. Quitt
1996-07-18  0:00                 ` Robert Dewar
1996-07-26  0:00                 ` Richard Riehle
1996-07-08  0:00             ` C is 'better' than Ada ... NOT!! Hugh Dunne
1996-07-08  0:00               ` Frank Manning
1996-07-08  0:00               ` Kevin D. Quitt
1996-07-12  0:00                 ` C is 'better' than Ada because John F. Bode
1996-07-15  0:00                   ` Sandy McPherson
1996-07-18  0:00                     ` Robert Dewar
1996-07-19  0:00                       ` Theodore E. Dennison
1996-07-19  0:00                     ` Ken Garlington
1996-07-20  0:00                       ` Michael Feldman
1996-07-21  0:00                         ` Alfonso Urdaneta
1996-07-21  0:00                           ` Robert Dewar
1996-07-22  0:00                             ` Kevin D. Quitt
1996-07-22  0:00                               ` Robert Dewar
1996-07-26  0:00                               ` Richard Riehle
     [not found]                             ` <31f3c52e.238719470 <Pine.GSO.3.92.960726122347.25896E-100000@nunic.nu.edu>
1996-07-31  0:00                               ` Darrin Smith
1996-07-31  0:00                                 ` Fergus Henderson
1996-08-01  0:00                                 ` Jerry van Dijk
1996-08-06  0:00                                   ` Kirk Bradley
1996-08-09  0:00                                   ` Richard Riehle
1996-08-10  0:00                                     ` Craig Franck
1996-08-16  0:00                                       ` Richard Riehle
1996-08-18  0:00                                         ` Craig Franck
     [not found]                                       ` <Pine.GSO.3.92.960816102000. <4v5pis$4h1@mtinsc01-mgt.ops.worldnet.att.net>
1996-08-18  0:00                                         ` David Weller
1996-08-15  0:00                                     ` Mike Stark
1996-08-02  0:00                                 ` Robert Dewar
1996-08-11  0:00                             ` Jon S Anthony
     [not found]                             ` <31f3c52e.238719470 <4uj42h$j06@mtinsc01-mgt.ops.worldnet.att.net>
1996-08-11  0:00                               ` Doug & Rose Miller
1996-08-11  0:00                                 ` Craig Franck
1996-08-11  0:00                                   ` Doug & Rose Miller
1996-08-12  0:00                                     ` Craig Franck
1996-08-16  0:00                                       ` nasser
     [not found]                             ` <31f3c52e.238719470 <4v5pis$4h1@mtinsc01-mgt.ops.worldnet.att.net>
1996-08-18  0:00                               ` Doug & Rose Miller
1996-08-20  0:00                                 ` Craig Franck
1996-07-23  0:00                         ` Ken Garlington
1996-07-27  0:00                       ` Tim Behrendsen
1996-07-27  0:00                         ` Lawrence Kirby
1996-07-29  0:00                         ` Ian Ward
1996-07-30  0:00                         ` Bob Cousins
1996-07-30  0:00                           ` Robert Dewar
1996-09-05  0:00                             ` Bob Cousins
1996-08-13  0:00                       ` Jon S Anthony
1996-08-14  0:00                         ` Craig Franck
1996-08-28  0:00                           ` Van Snyder
1996-08-14  0:00                       ` Jon S Anthony
1996-08-15  0:00                         ` Craig Franck
1996-08-15  0:00                           ` Joe Gwinn
1996-08-16  0:00                             ` Don Nelson
1996-08-19  0:00                               ` Joe Gwinn
1996-08-19  0:00                                 ` Ken Garlington
1996-08-28  0:00                         ` Van Snyder
1996-08-30  0:00                           ` Norman H. Cohen
1996-08-15  0:00                       ` Jon S Anthony
1996-08-20  0:00                         ` nasser
1996-08-15  0:00                       ` Stefan 'Stetson' Skoglund
1996-07-19  0:00                     ` Theodore E. Dennison
1996-08-15  0:00                     ` David Weller
1996-08-15  0:00                       ` William  C Brennan
1996-07-10  0:00             ` Stephen M O'Shaughnessy
1996-07-10  0:00               ` Peter Seebach
1996-07-18  0:00             ` Brian Rogoff
1996-07-19  0:00             ` James A. Squire
1996-07-29  0:00             ` William Clodius
1996-07-30  0:00               ` Richard A. O'Keefe
1996-07-30  0:00                 ` Tim Behrendsen
1996-08-01  0:00                   ` Byron B. Kauffman
1996-08-01  0:00                     ` Ian Ward
1996-07-30  0:00               ` Robert Dewar
1996-07-31  0:00                 ` Tim Behrendsen
     [not found]                   ` <9608020139.AA29105@pulsar.telesoft>
1996-08-02  0:00                     ` Tim Behrendsen [this message]
1996-08-05  0:00                       ` Kevin D. Quitt
1996-08-06  0:00                         ` is Ada 'better' than C? (Was: Re: C is 'better' than Ada because...) Antoine Leca
1996-08-06  0:00                           ` Kevin D. Quitt
1996-07-31  0:00               ` C is 'better' than Ada because Ralph Silverman
1996-07-30  0:00             ` Robert I. Eachus
1996-08-01  0:00               ` David Wheeler
1996-07-30  0:00             ` William Clodius
1996-08-01  0:00               ` Tim Behrendsen
1996-08-01  0:00             ` Olivier Devuns @pulsar
1996-08-11  0:00             ` Jon S Anthony
1996-08-12  0:00               ` Craig Franck
1996-08-12  0:00                 ` James A. Squire
1996-08-12  0:00                   ` Craig Franck
1996-08-12  0:00                 ` John Howard
1996-08-13  0:00                   ` Craig Franck
1996-08-13  0:00                     ` Ken Garlington
1996-08-14  0:00                       ` Craig Franck
1996-08-14  0:00                 ` Stephen M O'Shaughnessy
1996-08-14  0:00                 ` Stephen M O'Shaughnessy
     [not found]                 ` <Pine.GS <gwinn-1908961215100001@smc19.ed.ray.com>
1996-08-19  0:00                   ` Adam Beneschan
1996-08-11  0:00             ` Ada 95 is a FREE language (was: C is 'better' than Ada because...) Laurent Guerby
1996-08-13  0:00             ` C is 'better' than Ada because Jon S Anthony
1996-08-13  0:00             ` Jon S Anthony
1996-08-14  0:00             ` Norman H. Cohen
1996-08-19  0:00             ` Jon S Anthony
1996-08-20  0:00               ` Craig Franck
1996-08-20  0:00             ` Jon S Anthony
1996-08-21  0:00               ` Craig Franck
1996-08-27  0:00             ` Valentin Bonnard
1996-07-06  0:00         ` Walter B. Hollman Sr.
1996-07-05  0:00       ` Jon S Anthony
1996-07-08  0:00         ` Peter Hermann
1996-07-09  0:00           ` Dirk Dickmanns
1996-07-12  0:00       ` ntxbow
1996-07-15  0:00         ` Kevin D. Quitt
1996-07-15  0:00           ` Robert Dewar
1996-07-16  0:00           ` Ian Ward
1996-07-17  0:00             ` Dale Stanbrough
1996-07-23  0:00       ` Jon S Anthony
1996-07-29  0:00       ` William Clodius
1996-07-31  0:00       ` Darin Johnson
1996-08-01  0:00         ` Tim Behrendsen
1996-08-01  0:00       ` Jon S Anthony
1996-08-01  0:00       ` Jon S Anthony
1996-08-05  0:00       ` Stefan 'Stetson' Skoglund
1996-08-16  0:00       ` Jon S Anthony
     [not found] ` <874508446wnr@t-cubed.demon.co.uk>
1996-06-29  0:00   ` Jon S Anthony
1996-07-01  0:00 ` James A. Squire
1996-07-02  0:00 ` Darin Johnson
1996-07-03  0:00   ` If your only tool is a hammer, all your problems look like nails (was Re: C is 'better' than Ada because...) Bruce Clement
  -- strict thread matches above, loose matches on Subject: below --
1996-07-30  0:00 C is 'better' than Ada because Spasmo
1996-07-31  0:00 ` Jon S Anthony
1996-08-01  0:00   ` Tim Behrendsen
1996-08-02  0:00     ` Ralph Silverman
     [not found] ` <01bb7e29$61e3d260$87ee6fce@timpent.airshields.com>
1996-07-31  0:00   ` Bob Kitzberger
1996-07-31  0:00     ` Tim Behrendsen
1996-08-01  0:00 William Clodius
1996-08-03  0:00 ` Tim Behrendsen
1996-08-05  0:00   ` Kevin D. Quitt
1996-08-05  0:00 ` William Clodius
1996-08-05  0:00 ` Stefan 'Stetson' Skoglund
1996-08-01  0:00 Tim Behrendsen
1996-08-02  0:00 ` Mark McKinney
1996-08-02  0:00 ` David Bonham
     [not found] ` <9608061851.AA17508@camo.brc.shell.com>
1996-08-06  0:00   ` Tim Behrendsen
1996-08-04  0:00 @#$%!?!
     [not found] <Pine.GSO.>
     [not found] ` <4 <4vb399$kt8@mtinsc01-mgt.ops.worldnet.att.net>
1996-08-20  0:00   ` Adam Beneschan
1996-08-20  0:00     ` Craig Franck
1996-08-21  0:00     ` Mike Roske
1996-08-21  0:00       ` William  C Brennan
replies disabled

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