comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: C/C++ knocks the crap out of Ada
Date: 1996/03/23
Date: 1996-03-23T00:00:00+00:00	[thread overview]
Message-ID: <dewar.827606964@schonberg> (raw)
In-Reply-To: 4j173h$lvo@oravannahka.Helsinki.FI

Carl says

"So, is C really so much more efficient than other languages (I do not
question the efficiency of assembly, just C/C++) and is it not just a
myth? Does anyone have figures on this? I don't think a difference of a
few microseconds has any practical implications if that is what is
referred to."

There is no such language as C/C++

There are two completely different languages C and C++, the fact that
there is a significant intersection (it's only an intersection, C is not
a subset of C++) should not lead to confusing them into one language.

If you are looking at C, then the answer is no, C is not much more
efficient than other languages. This depends on implementations, not
languages. For example, Phillippe Kahn of Borland once suprised a
big meeting by noting that the fastest compiler for ANY langueg on
the prime number sieve benchmark was Realia COBOL (I am talking not
about compiler speed here, though Realia COBOL was and is the fastest
compiler on the PC, but about performance of executable code). What
are we to conclude from this? That COBOL is a more efficient language
than C? Of course not! Just that the Realia COBOL compiler had a better
code generator.

In the case of Ada, and C, the performance varies. If you use the same
code generator with similar code, then you get the same performance. Last
year at the UK Ada meeting, someone came to me and reported (with an amazed
tone) that Whetstone running on GNAT was comparable with Whetstone running
with GCC C (and was incidentally better than any other Ada compiler he had
tried). Fine, I was not surprised! What would have suprised me is if they
had been different -- that could only be caused by a bug. There are still some
bugs of this type around, where the GNAT/Ada performance is not what one would
expect, but they are getting steadily fixed.

Comparing C++ and Ada 95 wrt high level features like exceptions, dispatching,
and finalization is MUCH harder here. In fact for such features, the restuts
are even MORE likely to depend on implementatoin strategy and quality.

You *can* make some theoretical observations on efficiency. For example,
other things being equal, the obviously far superior aliasing information
available in Ada, due to its strong typing, and lack of pointer punning,
will give an advantage over C. However, things are almost never equal 
enough to actually measure these theoretical advantages.

Another point that may make Ada seem slow is that it is a higher level
language than C, and if you take advantage of high level features, you
pay a price. For example, if you use Unbounded_Strings and compare it
with do it yourself strings in C, with manual storage allocation, then
you will find that the Ada is slower. THat's because there is an overhead
to be paid for using high level features like the automatic finalization
that is part of the Unbounded_Strings implementation. On th other hand,
you have gained convenience and safety, which may well be worthwhile
trade offs.

I often find that Ada programmers are blissfully unaware of the consequences
of the code they write. It is instructive to use the -gnatdg switch in GNAT
which displays the low level generated code in a syntax close to normal
Ada to understand the consequneces of the use of high level features.





  reply	other threads:[~1996-03-23  0:00 UTC|newest]

Thread overview: 160+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <9603041841.AA18366@eight-ball>
     [not found] ` <4hg318$nup@ra.nrl.navy.mil>
1996-03-23  0:00   ` C/C++ knocks the crap out of Ada Carl J R Johansson
1996-03-23  0:00     ` Robert Dewar [this message]
1996-03-29  0:00     ` Richard Pitre
     [not found] <4jf3dg$8jm@ra.nrl.navy.mil>
1996-03-30  0:00 ` Jon S Anthony
     [not found] <DoInIF.HtK@world.std.com>
1996-03-19  0:00 ` Richard Pitre
     [not found] <00001a73+00002504@msn.com>
     [not found] ` <313EDF38.61C1@lfwc.lockheed.com>
     [not found] ` <4etcmm$lpd@nova.dimensional.com>
     [not found]   ` <4f4ptt$a1c@newsbf02.news.aol.com>
     [not found]     ` <4g1b7n$l5@mailhub.scitec.com.au>
     [not found]       ` <4g577o$28r@newsbf02.news.aol.com>
1996-02-17  0:00         ` Ell
1996-02-17  0:00       ` Robert Dewar
     [not found]       ` <3124B2F3.6D21@escmail.orl.mmc.com>
1996-02-19  0:00         ` Ramses Youhana
1996-02-19  0:00           ` Ted Dennison
1996-02-19  0:00       ` Adam Morris
1996-02-19  0:00         ` Ian S. Nelson
     [not found]       ` <JSA.96Feb16135027@organon.com>
     [not found]         ` <313D4D00.875@ix.netcom.com>
1996-02-19  0:00         ` Mike Stark
1996-02-20  0:00           ` Ed Franks
1996-02-21  0:00             ` Matthew M. Lih
1996-02-22  0:00               ` Ted Dennison
1996-02-25  0:00                 ` Thomas G. McWilliams
1996-02-25  0:00                   ` vancleef
1996-02-26  0:00                     ` Matthew M. Lih
1996-02-25  0:00                   ` Robert Dewar
1996-02-22  0:00             ` Bill Lee
1996-02-25  0:00               ` Ed Franks
     [not found]         ` <4hf701INNdl7@keats.ugrad.cs.ubc.ca>
     [not found]           ` <4hm6lo$eln@fred.netinfo.com.au>
     [not found]             ` <4hml8s$a1q@solutions.solon.com>
1996-03-15  0:00               ` Robert A Duff
1996-03-15  0:00                 ` Kazimir Kylheku
     [not found]         ` <DnuGrG.JrE@news.thomson-lcr.fr>
     [not found]           ` <4hl082INNc7d@keats.ugrad.cs.ubc.ca>
1996-03-15  0:00             ` AdaWorks
1996-03-15  0:00               ` Kazimir Kylheku
1996-03-18  0:00                 ` Matt Kennel
     [not found]         ` <adaworksDnrqsE.LpC@netcom.com>
     [not found]           ` <4hhred$1rn@sun152.spd.dsccc.com>
     [not found]             ` <4i19mg$vkt@azure.dstc.edu.au>
     [not found]               ` <4i4cf2$crm@sun152.spd.dsccc.com>
1996-03-15  0:00                 ` AdaWorks
1996-03-18  0:00                   ` Kevin Cline
1996-03-19  0:00                     ` Kazimir Kylheku
1996-03-20  0:00                       ` Kevin Cline
1996-03-20  0:00                         ` Richard Pitre
1996-03-21  0:00                         ` Kazimir Kylheku
1996-03-20  0:00                     ` AdaWorks
1996-03-22  0:00                       ` Kevin Cline
1996-03-22  0:00                         ` AdaWorks
1996-03-22  0:00                         ` David Weller
1996-03-26  0:00                     ` Ed Falis
1996-03-28  0:00                       ` Kevin Cline
1996-04-04  0:00                       ` Jon S Anthony
1996-03-26  0:00                     ` Jon S Anthony
1996-03-26  0:00                       ` Robert Dewar
1996-03-21  0:00                   ` Jon S Anthony
1996-03-22  0:00                     ` Kevin Cline
1996-03-21  0:00               ` Jon S Anthony
1996-03-22  0:00                 ` Kevin Cline
1996-03-30  0:00                   ` Jon S Anthony
1996-04-01  0:00                     ` Kevin Cline
1996-04-02  0:00                       ` Lawrence Kirby
1996-04-02  0:00                         ` Tom Payne
     [not found]   ` <BYERLY_J.96Feb7170158@srm9.motsat.sat.mot.com>
1996-02-19  0:00     ` Ramses Youhana
     [not found]     ` <1996Feb10.111307.113714@kuhub.cc.ukans.edu>
1996-02-21  0:00       ` AdaWorks
1996-02-20  0:00   ` Jon S Anthony
1996-02-20  0:00     ` Robert Dewar
1996-02-22  0:00     ` Matt Kennel
1996-02-20  0:00   ` Ted Dennison
1996-02-22  0:00     ` Robert Dewar
1996-02-20  0:00   ` Jon S Anthony
1996-02-20  0:00   ` Ken Garlington
1996-02-21  0:00     ` Robert S. White
1996-02-20  0:00   ` Lee Graba
1996-02-21  0:00     ` Mark A Biggar
1996-02-20  0:00   ` Ketil Z Malde
1996-02-21  0:00     ` Dirk Dickmanns
1996-02-21  0:00       ` 
1996-02-21  0:00       ` David Weller
1996-02-22  0:00       ` Gene Ouye
1996-02-21  0:00     ` Robert Dewar
1996-02-25  0:00       ` Andrew Koenig
1996-02-22  0:00     ` Bill Lee
1996-02-22  0:00     ` Gary McKee
1996-02-20  0:00   ` Jon S Anthony
     [not found]   ` <3114d8fb.5a455349@zesi.ruhr.de>
     [not found]     ` <4f5h5t$f13@vixen.cso.uiuc.edu>
     [not found]       ` <4g1bgf$l5@mailhub.scitec.com.au>
1996-02-17  0:00         ` Robert Dewar
1996-02-17  0:00         ` Tuishimi
     [not found]         ` <312515DF.7D3B@cmlj.demon.co.uk>
     [not found]           ` <4g3d70$nnn@queeg.apci.net>
1996-02-17  0:00             ` Chris Littlejohns
1996-02-18  0:00           ` ++           robin
1996-02-17  0:00             ` Robert Dewar
1996-02-19  0:00             ` Richard A. O'Keefe
1996-02-20  0:00               ` Robert Dewar
1996-02-22  0:00                 ` Richard A. O'Keefe
1996-02-22  0:00                   ` Ken Garlington
1996-02-22  0:00                     ` Ted Dennison
1996-02-19  0:00           ` Pete Becker
1996-02-20  0:00             ` Nasser Abbasi
1996-02-20  0:00               ` Andrew Koenig
1996-02-21  0:00                 ` Nasser Abbasi
1996-02-25  0:00                   ` J Greene
1996-02-26  0:00                     ` Peter Finney
1996-02-21  0:00                 ` Jay Martin
     [not found]             ` <4 <dirk.824894312@demokrit>
1996-02-21  0:00               ` Nasser Abbasi
1996-02-26  0:00                 ` Matthew B. Kennel
1996-02-27  0:00                   ` Robert Dewar
1996-02-27  0:00                     ` ron thompson
     [not found]             ` <4ggshe$7bk@go <4gh5r8$i2@mailhub.scitec.com.au>
1996-02-22  0:00               ` Nasser Abbasi
1996-02-22  0:00                 ` Robert Dewar
1996-02-23  0:00                 ` Richard A. O'Keefe
1996-02-22  0:00             ` Richard A. O'Keefe
1996-02-22  0:00               ` Ramses Youhana
1996-02-24  0:00               ` Ray Toal
1996-02-24  0:00                 ` Robert Dewar
1996-02-24  0:00                 ` JR Crosmer
1996-02-27  0:00                   ` Richard A. O'Keefe
1996-02-26  0:00                 ` James O'Connor
1996-02-23  0:00             ` Tom Payne
     [not found]         ` <4g2vn3$rgi@dfw.dfw.net>
1996-02-18  0:00           ` Robert Dewar
1996-02-19  0:00             ` AdaWorks
1996-02-23  0:00             ` Ghost In The Machine
1996-02-24  0:00               ` Robert Dewar
1996-02-25  0:00                 ` Ghost In The Machine
1996-02-19  0:00           ` Ramses Youhana
1996-02-19  0:00             ` Ian S. Nelson
1996-02-21  0:00             ` Peter Seebach
1996-02-19  0:00         ` Richard A. O'Keefe
1996-02-21  0:00           ` Ramses Youhana
1996-02-21  0:00           ` Peter Seebach
1996-02-21  0:00           ` Peter Seebach
1996-02-20  0:00     ` Ketil Z Malde
1996-02-20  0:00     ` Matt Austern
1996-02-23  0:00     ` Matthias Blume
1996-02-25  0:00       ` Robert Dewar
     [not found]   ` <4gaa <4gd94r$isu@mack.rt66.com>
1996-02-21  0:00     ` Nasser Abbasi
1996-02-21  0:00       ` David Weller
1996-02-21  0:00   ` Jon S Anthony
1996-02-21  0:00   ` Ken Garlington
1996-02-22  0:00   ` Ketil Z Malde
1996-02-22  0:00   ` Jon S Anthony
1996-02-26  0:00   ` Matt Austern
1996-02-26  0:00   ` Matt Austern
     [not found] ` <Pine.A32.3.91.960313165249.124278B-100000@red.weeg.uiowa.edu>
     [not found]   ` <4i9ld6$m2v@rational.rational.com>
     [not found]     ` <4iah20$p7k@saba.info.ucla.edu>
1996-03-15  0:00       ` Kazimir Kylheku
1996-03-15  0:00       ` Kazimir Kylheku
1996-03-15  0:00         ` Jay Martin
1996-03-15  0:00       ` Peter Seebach
1996-03-15  0:00       ` Ian Johnston (by ubsswop)
1996-03-16  0:00       ` Zsoter Andras
1996-03-19  0:00         ` Kazimir Kylheku
1996-03-21  0:00         ` Glenn H. Porter
1996-03-15  0:00 ` Kazimir Kylheku
1996-03-16  0:00   ` Jay Martin
1996-03-17  0:00     ` Kazimir Kylheku
1996-03-19  0:00     ` Sheldon White
1996-03-20  0:00       ` Jay Martin
1996-03-16  0:00 ` Jay Martin
1996-03-20  0:00   ` David Taylor
     [not found] ` <31442F19.6C13@lfwc.lockheed.com>
     [not found]   ` <4i26uhINNsd@keats.ugrad.cs.ubc.ca>
     [not found]     ` <31457584.2475@lfwc.lockheed.com>
1996-03-21  0:00       ` Ron Collins
     [not found]       ` <4i4s5f$igc@solutions.solon.com>
     [not found]         ` <3146E324.5C1E@lfwc.lockheed.com>
     [not found]           ` <4i98gg$8n1@solutions.solon.com>
     [not found]             ` <Do9tMv.2p3@world.std.com>
     [not found]               ` <4ia41k$e04@solutions.solon.com>
1996-03-18  0:00                 ` Norman H. Cohen
1996-03-19  0:00                 ` Charles H. Sampson
1996-03-19  0:00                   ` Peter Seebach
     [not found]           ` <Pine.A32.3.91.960313165249.124278B-100000@ <4ic92p$2fa@ubszh.fh.zh.ubs.com>
1996-03-29  0:00             ` mich
     [not found] <DoBFpD.Htx@world.std.com>
1996-03-15  0:00 ` Richard Pitre
1996-03-15  0:00   ` Robert A Duff
     [not found]     ` <4icqe6$9v@ra.nrl.navy.mil>
     [not found]       ` <DoDq5n.40@world.std.com>
1996-03-16  0:00         ` Richard Pitre
1996-03-16  0:00         ` Richard Pitre
1996-03-17  0:00         ` Alan Brain
1996-02-19  0:00 Simon Johnston
     [not found] <19960206T135716Z@arcana.naggum.no>
1996-02-17  0:00 ` Tuishimi
1996-02-17  0:00 ` Tuishimi
     [not found] <4fm9d8$mgs@azure.dstc.edu.au>
1996-02-17  0:00 ` Tuishimi
     [not found] <4fnv2r$n84@stc06.ctd.ornl.gov>
1996-02-17  0:00 ` Tuishimi
     [not found] <DMnEAz.ADn@research.att.com>
1996-02-17  0:00 ` Tuishimi
1996-02-19  0:00   ` Norman H. Cohen
     [not found] <JSA.96Feb7021245@organon.com>
1996-02-17  0:00 ` Tuishimi
replies disabled

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