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=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9adfbb907494972e X-Google-Attributes: gid103376,public X-Google-Thread: 1014db,9adfbb907494972e X-Google-Attributes: gid1014db,public From: "Tim Behrendsen" Subject: Re: Ada to C/C++ translator needed Date: 1996/09/30 Message-ID: <01bbaee1$00ee1c20$87ee6fce@timpent.a-sis.com>#1/1 X-Deja-AN: 186238947 references: <32499FA0.4B5E@magic.fr> <52e5t5$m28@btmpjg.god.bel.alcatel.be> <52feul$os2@goanna.cs.rmit.edu.au> <01bbad6e$67743f20$32ee6fcf@timhome2> <52o1ve$gra@goanna.cs.rmit.edu.au> content-type: text/plain; charset=ISO-8859-1 organization: A-SIS mime-version: 1.0 newsgroups: comp.lang.c,comp.lang.ada Date: 1996-09-30T00:00:00+00:00 List-Id: Richard A. O'Keefe wrote in article <52o1ve$gra@goanna.cs.rmit.edu.au>... > "Tim Behrendsen" writes: > > >I hope you're not suggesting that comparing compilers on one > >system with one program tells you *anything* about the relative > >merits of languages ... > > Of course I am. Have you no logic in you at all, man? > Here's what it tells me: > > not (forall X: Problem > forall S: System > forall A: Ada_Compiler > forall C: C_Compiler > runs_on(A, S) & runs_on(C, S) => > slower(code(X, A), code(X, C)) > ) > > If an expensive optimising C compiler (developed for a specific machine, > with *intimate* knowledge of that machine) can't beat a free Ada compiler > which runs on a wide range of machines, when given idiomatic code for a > fairly straightfoward program, what would _you_ conclude? I would conclude that for that *specific* problem, the C compiler did a bad job of optimization. As I frequently point out (and I frequently get abuse for it), optimizers are very imperfect beasts at best. Do you doubt that if we brought the writers of the Sun compiler and had them fix their optimizer, they couldn't make it produce *exactly* the same code as the Ada compiler (or Fortran compiler, for that matter)? Of course they could. The real question that you refuse to come to terms with is, what is the average case over a large set of compilers over a large set of non-trivial programs over a large set of problem types? And this is a very difficult question to answer. Your suggestion that comparing compilers on one platform for one program tells you something significant is laughable at best. > *Every* time I have bothered to write the same thing in Ada and C, I have > obtained the same results on this machine. There isn't anything about the > SPARC that should tip the balance in favour of Ada. Quite the reverse, in > fact. Sounds like it's a crappy C optimizer to me, especially considering the wide disparity between the C results and the other languages. *This* is a reasonable conclusion. If you have bothered to write other programs in C and Ada, that would indicate to me that they were trivial algorithms, and therefore your conclusions invalid. Look at it this way; if I implement an algorithm in two languages, C and C++, and compare the results, they will probably be very similiar (if not identical). However, let's take a very large project with two teams of people, and have 1 implement the project using C, and one implement it using C++. I have no formal study for this, but speaking to many people who have gone through the process, and reading a lot about many manager's experiences, I have heard a common theme: Projects implemented using OOP within the C++ language have experienced significant performance problems because of the overhead of class structures, heavy dependance on dynamic memory allocation, and the difficulty in designing good object classes. This is not because of optimization; this is because of the language and style in which projects are implemented. Now, this is a significant debatable question. Comparing the output of optimizers is completely worthless to the central question of whether REAL WORLD projects can be implement efficiently in a particular language or not. -- Tim Behrendsen (tim@a-sis.com)