comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: Code size of Ada ? was Re: Ada95 Strengths/Weaknesses.
Date: 1999/09/30
Date: 1999-09-30T00:00:00+00:00	[thread overview]
Message-ID: <7svmrk$tkl$1@nnrp1.deja.com> (raw)
In-Reply-To: 37F349BB.B1F39ECF@icn.siemens.de

In article <37F349BB.B1F39ECF@icn.siemens.de>,
  Alfred Hilscher <Alfred.Hilscher@icn.siemens.de> wrote:
> Ok, so can you please tell me what I'm doing wrong ?  --> All
my test
> (from a
> simple "Hello world" upto a TCP/IP program with tasks) >--
generate much
> bigger exe-files (WIN/NT or OS/2) than the C, Pascal or
Modula-2
> compilers I've tried.

Obviously a program using Ada tasks is in no way comparable to
any C program. If you want to compare an Ada program to a C
program using explicit thread calls, compare an Ada program
using the same explicit thread calls, since Ada tasking
semantics is at a totally different level. Once again, one
has to see the exact code you are using.

> I used the default settings.

Well I trust for example that you made sure the executable
was stripped, and of course you would have used -gnatp (since
otherwise you are comparing run time checked code with code
that is not run time checked). And of course you used -O2
since doing any kind of size or speed performance testing
with the default -O0 is complete and utter nonsense.

So if you are really saying that you used none of these
switches, you are not even BEGINNING to do a sensible
comparison.

> What switches are
> needed to generate the smallest possible code ?

Well you probably want to kill inlining completely with
-fno-inline for example, there are many switches for the
compiler, you need to read the documentation thoroughly
to answer a question like this.

>
> That the same argument I've got from M$. "If your system,
fixpack,
> office... does not fitt on your disk - just buy a bigger one".
> Does that mean I should work harder to get more money for
bigger
> disks, main memory, a faster processor ("oh, you still work
with PII
> with 266 MHz, thats why Word need so much time to open your
document").

You have a great tendency to obfuscate here by introducing
completely irrelevant stuff and considering them together
(just like you did with speed and space in your previous
message).

No one here is talking about main memory or a faster processor,
so why did you introduce these red herrings. What we are talking
about is that typically Ada programs have a slightly larger
fixed overhead for the runtime, and that results in a trivial
amount of extra disk usage (in the tenths of cents), for storing
an Ada program. Since you can store hundreds of Ada programs in
the space for a small video clip, this is really a non-issue.

> What do you think about "Load time" ? Isn't it right that a
smaller
> program
> is faster loaded than a bigger one ? Especially when loading
is done via
> LAN.

First of all, I think that load time has nothing to do with the
size of the executable file, or to be more accurate is not
directly related to this size. Why not, because debugging
information is not loaded unless you are debugging.

Second, with todays disks, the small fixed overhead (20K or
whatever) results in negligible differences in load time.

Now if a comparable program of large size say took 4 megs
instead of 2 megs, that would be a concern, but we have no
data in this thread substantiating such a phenomenon, and all
our experience, at least with GNAT, is that comparably written
large programs are about the same size in Ada as in C. Seeing
as there is a common code generator, it would be surprising if
this were not the case.

Now of course if you use high level constructs in Ada that have
no analogy in C, you will pay a price. But that's always the
case, programming at a higher semantic level almost always
(not always, but almost) costs in space and time (if you don't
like this, you can always write in machine language and save
lots of time and space over high level languages like C :-)

As I have noted before, doing meaningful comparisons between
languages or compilers is not at all an easy task. The people
doing it need to be thoroughly familiar with all the factors
involved. If you are asking the question "what options do I
use to get a minimum sized program", then you don't have the
necessary knowledge to do the comparison. So, my first
suggestion is thoroughly read BOTH the relevant Ada *and*
C manuals (for all I know the C experiment is also fatally
flawed -- certainly for instance using gcc with the default
-O0 to compile C and reasoning about the result is nonsense).

There are lots of fine points, for example, clearly if you
are interested in space, you use -O2, *NOT* -O3. If you don't
know why, go and look up what these switches do!

This is not an easy area at all, and it is all too easy to do
bogus experiments and be lead off in all sorts of invalid
directions (we have had plenty of claims in the opposite
direction, e.g. the absurd claim that it is impossible to
write portable code in C ...) They are not helpful whichever
bogus conclusion they lead to ...


Sent via Deja.com http://www.deja.com/
Before you buy.




  parent reply	other threads:[~1999-09-30  0:00 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-27  0:00 Ada95 Strengths/Weaknesses the middleman
1999-09-27  0:00 ` J. David Bryan
1999-09-27  0:00 ` Steve Doiel
1999-09-27  0:00 ` David Starner
1999-09-28  0:00   ` Robert Dewar
1999-09-28  0:00     ` David Starner
1999-09-29  0:00       ` Robert A Duff
1999-09-28  0:00     ` David Starner
1999-09-28  0:00       ` Robert Dewar
1999-09-28  0:00         ` Ray Blaak
1999-09-28  0:00   ` Robert Dewar
1999-09-28  0:00     ` David Starner
1999-09-28  0:00       ` Gautier
1999-09-28  0:00         ` David Starner
1999-09-29  0:00           ` Robert Dewar
1999-09-28  0:00         ` Ed Falis
1999-09-28  0:00           ` David Starner
1999-09-29  0:00           ` Robert Dewar
1999-09-28  0:00       ` p.obry
1999-09-28  0:00         ` David Starner
1999-09-28  0:00           ` Richard D Riehle
1999-09-28  0:00       ` Robert Dewar
1999-09-28  0:00         ` David Starner
1999-09-29  0:00           ` Robert Dewar
1999-09-30  0:00         ` Pragma (was Re: Ada95 Strengths/Weaknesses.) Preben Randhol
1999-09-30  0:00           ` Preben Randhol
1999-09-28  0:00       ` Ada95 Strengths/Weaknesses Robert Dewar
1999-09-28  0:00       ` Ted Dennison
1999-09-28  0:00         ` Simon Wright
1999-09-28  0:00     ` Code size of Ada ? was " Alfred Hilscher
1999-09-28  0:00       ` Gautier
1999-09-28  0:00       ` David Botton
1999-09-29  0:00       ` Robert Dewar
1999-09-29  0:00         ` Alfred Hilscher
1999-09-29  0:00           ` Robert Dewar
1999-09-30  0:00             ` Alfred Hilscher
1999-09-30  0:00               ` Gautier
1999-09-30  0:00               ` Robert Dewar
1999-09-29  0:00         ` Larry Kilgallen
1999-09-29  0:00           ` Robert Dewar
1999-09-29  0:00           ` Alfred Hilscher
1999-09-29  0:00             ` Gautier
1999-09-29  0:00               ` Ed Falis
1999-09-29  0:00                 ` Gautier
1999-09-29  0:00                 ` tmoran
1999-09-30  0:00               ` Robert Dewar
1999-09-29  0:00             ` Robert Dewar
1999-09-30  0:00               ` Alfred Hilscher
1999-09-30  0:00                 ` Gautier
1999-09-30  0:00                   ` Robert Dewar
1999-09-30  0:00                   ` Robert Dewar
1999-09-30  0:00                   ` Robert Dewar
1999-09-30  0:00                 ` Robert Dewar [this message]
1999-09-30  0:00                   ` tmoran
1999-09-30  0:00                   ` Ehud Lamm
1999-09-30  0:00                     ` Robert Dewar
     [not found]                       ` <7t2e1l$lqt2@ftp.kvaerner.com>
     [not found]                         ` <37F91D6E.58685CFE@mitre.org>
     [not found]                           ` <7tf7uo$h2b$1@nnrp1.deja.com>
     [not found]                             ` <37FBA978.A86762F1@mitre.org>
1999-10-18  0:00                               ` Robert Dewar
1999-10-19  0:00                                 ` Code size of Ada ? Robert I. Eachus
     [not found]                           ` <7tf7uo <37FBA978.A86762F1@mitre.org>
     [not found]                             ` <5OkO3.2$1e.659@typhoon.nyu.edu>
1999-10-19  0:00                               ` Code size of Ada ? was Re: Ada95 Strengths/Weaknesses Robert I. Eachus
1999-09-29  0:00             ` Ted Dennison
1999-09-29  0:00           ` Robert Dewar
1999-09-28  0:00     ` GNAT listing file default names (was: Ada95 Strengths/Weaknesses) Larry Kilgallen
1999-09-28  0:00       ` Gautier
1999-09-29  0:00         ` Robert Dewar
1999-09-29  0:00       ` Robert Dewar
1999-09-29  0:00         ` Larry Kilgallen
1999-09-29  0:00           ` Robert Dewar
1999-09-29  0:00             ` Larry Kilgallen
1999-09-30  0:00               ` Robert Dewar
1999-09-28  0:00   ` Ada95 Strengths/Weaknesses the middleman
1999-09-27  0:00 ` Marin David Condic
1999-09-27  0:00   ` Hyman Rosen
1999-09-28  0:00     ` Robert Dewar
1999-09-28  0:00       ` Preben Randhol
1999-09-28  0:00         ` bill
1999-09-27  0:00           ` Aidan Skinner
1999-09-28  0:00           ` Preben Randhol
1999-09-28  0:00           ` Larry Kilgallen
1999-09-28  0:00           ` Steve Doiel
1999-09-28  0:00     ` Ed Falis
1999-09-28  0:00       ` Hyman Rosen
1999-09-28  0:00         ` Ed Falis
1999-09-28  0:00   ` Preben Randhol
1999-09-28  0:00 ` Geoff Bull
1999-09-28  0:00 ` Geoff Bull
1999-09-29  0:00   ` the middleman
1999-09-29  0:00     ` Robert A Duff
replies disabled

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