Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch > #32182

Re: Here is what i think of C and C++

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.arch
Subject Re: Here is what i think of C and C++
Date 2015-12-27 17:43 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2015Dec27.184315@mips.complang.tuwien.ac.at> (permalink)
References <n5mnne$kjv$6@dont-email.me> <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>

Show all headers | View raw


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?

- anton
-- 
M. Anton Ertl                    Some things have to be seen to be believed
anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html

Back to comp.arch | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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