From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,81cf52699486abe7 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: Code size of Ada ? was Re: Ada95 Strengths/Weaknesses. Date: 1999/09/30 Message-ID: <7svmrk$tkl$1@nnrp1.deja.com> X-Deja-AN: 531094514 References: <37EED7B8.245C0054@yukyonline.co.yuky> <7smp30$9aa1@news.cis.okstate.edu> <7sp8m9$a6e$1@nnrp1.deja.com> <37F0D03C.DE4807D4@icn.siemens.de> <7srnb9$2u3$1@nnrp1.deja.com> <1999Sep29.075617.1@eisner> <37F22BB1.F3524D60@icn.siemens.de> <7sts6b$kla$1@nnrp1.deja.com> <37F349BB.B1F39ECF@icn.siemens.de> X-Http-Proxy: 1.0 x41.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Thu Sep 30 12:59:38 1999 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-09-30T00:00:00+00:00 List-Id: In article <37F349BB.B1F39ECF@icn.siemens.de>, Alfred Hilscher 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.