Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Walter Banks <walter@bytecraft.com> |
|---|---|
| Newsgroups | comp.arch |
| Subject | Re: Here is what i think of C and C++ |
| Date | 2015-12-28 00:18 -0500 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <n5qgnn$m46$1@speranza.aioe.org> (permalink) |
| References | (1 earlier) <fec45b86-9461-4bce-b8a3-0df45d49191f@googlegroups.com> <n5n18a$jk9$1@speranza.aioe.org> <01420908-cd92-4d55-9a0e-7078f72f19dd@googlegroups.com> <n5p14v$knq$1@speranza.aioe.org> <2015Dec27.184315@mips.complang.tuwien.ac.at> |
On 27/12/2015 12:43 PM, Anton Ertl wrote: > Walter Banks <walter@bytecraft.com> writes: >> On 26/12/2015 2:07 PM, Rick C. Hodgin wrote: >>>> C and C++ offer freedoms that gain performance. It requires >>>> more i-dotting and t-crossing, but will produce code that is >>>> often 2x ormore) faster than Ada or other languages which >>>> impose such restrictions, even if they are good >>>> implementations. Their strict type-checking rules require CPU >>>> time to implement. >> >>> Walter Banks: >>>> Compile time or execution time? >>> >>> Execution time. >>> >> >> I have written compilers for both C and Pascal. Pascal and ADA >> type languages take more time to parse and validate source, but >> take significantly less time to optimize generated code. > > That is their choice. Of course, if you leave away things like > induction variable elimination from a Pascal or Ada compiler, it > will often hurt more than if you leave it away from a C compiler, > because thanks to pointer arithmetics in C the programmers can > eliminate induction variables in the source code that cannot be > eliminated in the source code in Pascal or Ada. > >> Generated C code needs to account at run time for many things that >> Pascal/ADA type languages establish at compile time. > > Such as? C compilers certainly don't type-check at run-time. > Admittedly Pascal and Ada compilers have some alias information that > well-behaved C compilers won't use, but that does not make much > difference (see below), and as a Pascal and Ada fan you probably > welcome the broken C compilers that make Pascal-like alias > assumptions, and will perform the "optimizations" without proving > that they won't change the behaviour of the program. > > As for "not much difference", Wang et al. > <http://people.csail.mit.edu/nickolai/papers/wang-undef-2012-08-21.pdf> > > found that in all of the SPECint benchmarks, there was only one place > where "strict aliasing" caused a measurable difference (6%-12% for > that program, <1% for the overall SPECint result); the same benefit > could be achieved by a small change in the source code of that > program. > >> The very type checking that occurs at compile time does a lot to >> simplify the generated code. > > Example? > I think that BGB basically answered this. The more you know about a program at compile time the more agressive you can be at optimizing the generated code. That is also the basis of the code generation differences I have seen. I am both a C fan and ADA/Pascal fan. I have preferences for one or the other depending on the application code. Put in perspective I have represented Canada at WG-14 working on C standards and have written C compilers in both C and Pascal. For compiler applications I prefer Pascal but have used C by choice for essentially all the embedded systems applications I have worked on. w..
Back to comp.arch | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Here is what i think of C and C++ Ramine <ramine@1.1> - 2015-12-26 13:56 -0800
Here is what i think of C and C++ "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-12-26 11:07 -0800
Re: Here is what i think of C and C++ Quadibloc <jsavard@ecn.ab.ca> - 2015-12-26 12:17 -0800
Re: Here is what i think of C and C++ jim.brakefield@ieee.org - 2015-12-26 16:31 -0800
Re: Here is what i think of C and C++ "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-12-27 11:39 -0800
Re: Here is what i think of C and C++ George Neuner <gneuner2@comcast.net> - 2015-12-28 14:16 -0500
Re: Here is what i think of C and C++ Walter Banks <walter@bytecraft.com> - 2015-12-26 16:36 -0500
Re: Here is what i think of C and C++ "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-12-26 14:14 -0800
Re: Here is what i think of C and C++ Walter Banks <walter@bytecraft.com> - 2015-12-27 10:46 -0500
Re: Here is what i think of C and C++ BGB <cr88192@hotmail.com> - 2015-12-27 09:50 -0600
Re: Here is what i think of C and C++ "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-12-27 09:57 -0800
Re: Here is what i think of C and C++ anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-27 17:43 +0000
Re: Here is what i think of C and C++ Walter Banks <walter@bytecraft.com> - 2015-12-28 00:18 -0500
Re: Here is what i think of C and C++ Walter Banks <walter@bytecraft.com> - 2015-12-28 00:30 -0500
Re: Here is what i think of C and C++ Anonymous <no_email@invalid.invalid> - 2015-12-27 04:27 +0000
Re: Here is what i think of C and C++ "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-12-27 09:44 -0800
Re: Here is what i think of C and C++ EricP <ThatWouldBeTelling@thevillage.com> - 2015-12-27 16:35 -0500
Re: Here is what i think of C and C++ Megol <golem960@gmail.com> - 2015-12-27 07:23 -0800
csiph-web