Path: utzoo!utgpu!watmath!clyde!mcdchg!chinet!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!purdue!decwrl!sun!pitstop!sundc!seismo!uunet!munnari!munmurra!lean From: lean@munmurra.mu.oz (Giles Lean) Newsgroups: comp.lang.c++ Subject: Re: C++ : A free lunch ? Message-ID: <715@munmurra.mu.oz> Date: 29 Oct 88 04:36:41 GMT References: <17558@gatech.edu> Organization: Comp Sci, Melbourne Uni, Australia Lines: 44 Continuing the C++ efficiency debate, in article <17558@gatech.edu>, snm@horus.gatech.edu (Sathis Menon) says: >In article <77300014@p.cs.uiuc.edu> johnson@p.cs.uiuc.edu writes: >> >>C++ is just as fast as C (within + or - 2%). We have written an >>operating system (Choices) in C++ and are getting very good performance >>figures from it. There is essentially no performance overhead in >>using C++. > The distributed OS project that I am working on (Clouds Project at > Georgia Tech) is using g++ (GNU C++) to implement the kernel and > system objects (essential system services). Unfortunately, the > optimizer that we got from GNU folks assumed a little too much, > which doesn't go hand in hand with low level coding. Hence, we don't > optimize the code right now and the code generated is worse than C code > (by checking the assembler listing, of course). Firstly, judging the quality of code output by an optimising compiler before the optimising pass is not sensible for assessing the efficiency of a language. The compiler may have offloaded even basic optimisations onto the optimiser. Further, comparing the output from two compilers as a language comparison only makes sense if the compilers are somehow "equivalent" - i.e. both generating the "best" code possible. (Both being very basic generating naive code is not appropriate for an efficiency comparison.) What was the C compiler you compared g++ with? > OK., you are getting good performance figures from your OS using C++, but > did you have a parallel implementation in C to compare it?. Are you > implying that the "very good performance figures" that you mention > are attibuted to C++ (at least partly)? The question is still open - I can't see that you can claim that your g++ code is worse than C code, but only that in this instance the g++ optimiser prevents you using C++ to its fullest. Vote (1) for disableable features in optimisers! Giles Lean My own opinions, which have been wrong before, lean@munnari.oz and I don't have an employer until February! University of Melbourne