Time and memory performance of C versus C++

Discussion in 'C++' started by Generic Usenet Account, Nov 9, 2007.

  1. A lot of research has been done to prove that the contention that C
    code is more efficient and more compact than equivalent C++ code is a
    myth. My posting pertains to a slightly different aspect of this
    debate. Here are my two questions:

    1) Does anyone have any information on comparison of C and C++
    software written for the ARM processor?

    2) Are there any compiler and CPU dependencies that have to be
    factored in while debating this issue? Or, is the issue more or less
    settled for all compilers and all CPUs?

    Thanks,
    Kandregula Anil K.
     
    Generic Usenet Account, Nov 9, 2007
    #1
    1. Advertising

  2. Generic Usenet Account wrote:
    > A lot of research has been done to prove that the contention that C
    > code is more efficient and more compact than equivalent C++ code is a
    > myth.


    I'll take your word for it.

    > My posting pertains to a slightly different aspect of this
    > debate. Here are my two questions:
    >
    > 1) Does anyone have any information on comparison of C and C++
    > software written for the ARM processor?
    >
    > 2) Are there any compiler and CPU dependencies that have to be
    > factored in while debating this issue?


    No. There is no point in debating this "issue" whatsoever. I am
    sure that among my brethren in 'comp.lang.c' there will be somebody
    with a different opinion, of course.

    > Or, is the issue more or less
    > settled for all compilers and all CPUs?


    http://www.research.att.com/~bs/bs_faq.html#C-is-better Do you see
    any mention of a platform or CPU?

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Nov 9, 2007
    #2
    1. Advertising

  3. Generic Usenet Account

    Ian Collins Guest

    Generic Usenet Account wrote:
    > A lot of research has been done to prove that the contention that C
    > code is more efficient and more compact than equivalent C++ code is a
    > myth. My posting pertains to a slightly different aspect of this
    > debate. Here are my two questions:
    >
    > 1) Does anyone have any information on comparison of C and C++
    > software written for the ARM processor?
    >

    One can write piss poor inefficient code in either language, or one can
    write elegant efficient code in either. Programmers write code, not
    compilers, so there isn't anything to study or discuss.

    --
    Ian Collins.
     
    Ian Collins, Nov 9, 2007
    #3
  4. Generic Usenet Account

    Guest

    On Nov 9, 2:48 pm, Ian Collins <> wrote:
    > Generic Usenet Account wrote:
    > > A lot of research has been done to prove that the contention that C
    > > code is more efficient and more compact than equivalent C++ code is a
    > > myth. My posting pertains to a slightly different aspect of this
    > > debate. Here are my two questions:

    >
    > > 1) Does anyone have any information on comparison of C and C++
    > > software written for the ARM processor?

    >
    > One can write piss poor inefficient code in either language, or one can
    > write elegant efficient code in either. Programmers write code, not
    > compilers, so there isn't anything to study or discuss.
    >
    > --
    > Ian Collins.


    These days with 3ghz computers with more than 1 gbyte RAM what is so
    important about elegant, efficient code?
     
    , Nov 9, 2007
    #4
  5. Generic Usenet Account

    Guest

    wrote:
    ....
    > These days with 3ghz computers with more than 1 gbyte RAM what is so
    > important about elegant, efficient code?


    As our computers get more powerful, the problems we try to solve with
    them get more difficult. If you have a program which takes 10 days to
    run on a 3-GHz machine with 1GB RAM, an algorithm change that causes a
    speed-up by a factor of 2 is going to look pretty sweet.

    Truly elegant code is easier to understand and maintain; with
    programmer time costing so much more than CPU time, elegance is
    getting steadily more important, not less.
     
    , Nov 9, 2007
    #5
  6. Generic Usenet Account

    Tor Rustad Guest

    Re: Time and memory performance of C versus C++ [TROLL ALERT]

    Generic Usenet Account wrote:
    > A lot of research has been done to prove that the contention that C
    > code is more efficient and more compact than equivalent C++ code is a
    > myth. My posting pertains to a slightly different aspect of this
    > debate. Here are my two questions:
    >
    > 1) Does anyone have any information on comparison of C and C++
    > software written for the ARM processor?


    Platform or C++ specific questions, are off-topic in c.l.c

    > 2) Are there any compiler and CPU dependencies that have to be
    > factored in while debating this issue? Or, is the issue more or less
    > settled for all compilers and all CPUs?


    Compiler or CPU specific questions, are off-topic in c.l.c


    --
    Tor < | tr i-za-h a-z>
     
    Tor Rustad, Nov 9, 2007
    #6
  7. Generic Usenet Account

    jacob navia Guest

    wrote:
    > On Nov 9, 2:48 pm, Ian Collins <> wrote:
    >> Generic Usenet Account wrote:
    >>> A lot of research has been done to prove that the contention that C
    >>> code is more efficient and more compact than equivalent C++ code is a
    >>> myth. My posting pertains to a slightly different aspect of this
    >>> debate. Here are my two questions:
    >>> 1) Does anyone have any information on comparison of C and C++
    >>> software written for the ARM processor?

    >> One can write piss poor inefficient code in either language, or one can
    >> write elegant efficient code in either. Programmers write code, not
    >> compilers, so there isn't anything to study or discuss.
    >>
    >> --
    >> Ian Collins.

    >
    > These days with 3ghz computers with more than 1 gbyte RAM what is so
    > important about elegant, efficient code?
    >
    >


    This is the attitude that leads to shitty and bloated programs.

    Since shitty programs are the way to go (they cost less effort
    to write, they lead to the user buying a new machine, they make the
    economy go round) you are right of course.

    Let's write the new computer language: C# running in a virtual
    machine written in GWBASIC.



    --
    jacob navia
    jacob at jacob point remcomp point fr
    logiciels/informatique
    http://www.cs.virginia.edu/~lcc-win32
     
    jacob navia, Nov 9, 2007
    #7
  8. "Generic Usenet Account" <> wrote in message
    news:...
    > A lot of research has been done to prove that the contention that C
    > code is more efficient and more compact than equivalent C++
    > code is a myth.


    Of course it's a myth. If you write equivalent code, the performance will
    be nearly identical, since AFAIK all interesting compilers share the code
    generation engine across both C and C++ modes.

    OTOH, C++ allows you to write a different style of code that can't (easily
    or efficiently) be written in C. C++'s additional features to support that
    style also tend to be the features that are either particularly slow to
    execute or encourage programmers to write slow code -- but they also tend to
    make the code code faster to write and easier to understand and debug.
    Depending on the purpose and use of the code, that may or may not be a smart
    trade-off.

    (Specifically, templates and classes can save massive amounts of programmer
    time -- but they also hide from the programmer what's going on under the
    hood so that he/she may not realize that a simple-looking statement may be
    hundreds of times more complex than a slightly more-complex-looking
    statement.)

    > My posting pertains to a slightly different aspect of this debate.
    > Here are my two questions:
    >
    > 1) Does anyone have any information on comparison of C and C++
    > software written for the ARM processor?


    The processor type has nothing to do with it.

    > 2) Are there any compiler and CPU dependencies that have to be
    > factored in while debating this issue? Or, is the issue more or less
    > settled for all compilers and all CPUs?


    The latter, at least in the sense it's "settled" that your question is
    either nonsensical or irrelevant.

    S

    --
    Stephen Sprunk "God does not play dice." --Albert Einstein
    CCIE #3723 "God is an inveterate gambler, and He throws the
    K5SSS dice at every possible opportunity." --Stephen Hawking


    --
    Posted via a free Usenet account from http://www.teranews.com
     
    Stephen Sprunk, Nov 9, 2007
    #8
  9. Generic Usenet Account

    Ian Collins Guest

    wrote:
    > On Nov 9, 2:48 pm, Ian Collins <> wrote:
    >> Generic Usenet Account wrote:
    >>> A lot of research has been done to prove that the contention that C
    >>> code is more efficient and more compact than equivalent C++ code is a
    >>> myth. My posting pertains to a slightly different aspect of this
    >>> debate. Here are my two questions:
    >>> 1) Does anyone have any information on comparison of C and C++
    >>> software written for the ARM processor?

    >> One can write piss poor inefficient code in either language, or one can
    >> write elegant efficient code in either. Programmers write code, not
    >> compilers, so there isn't anything to study or discuss.
    >>

    *Please* don't quote signatures
    >
    > These days with 3ghz computers with more than 1 gbyte RAM what is so
    > important about elegant, efficient code?
    >

    Do you have any pride in your work?

    --
    Ian Collins.
     
    Ian Collins, Nov 9, 2007
    #9
  10. Generic Usenet Account

    moschops Guest

    wrote:

    >
    > These days with 3ghz computers with more than 1 gbyte RAM what is so
    > important about elegant, efficient code?
    >
    >



    Hey, that's great! Where can I pick up one of these 3ghz 1GB RAM
    computers? I need it to be about 3 cm by 3 cm all in, drawing no more
    than one amp of current and using about 10W of power, with a JTAG port
    on board.

    What's that, you say? There's no such thing? Well then, I guess I'll
    have to use whatever I can get in that size, current and power
    limitations and just do some damned elegant coding to get it to do what
    I need.

    Lift your head from the keyboard once in a while, chum. There's more to
    computing that desktop PCs.

    'Chops
     
    moschops, Nov 9, 2007
    #10
  11. Generic Usenet Account

    jacob navia Guest

    moschops wrote:
    > wrote:
    >
    >>
    >> These days with 3ghz computers with more than 1 gbyte RAM what is so
    >> important about elegant, efficient code?
    >>
    >>

    >
    >
    > Hey, that's great! Where can I pick up one of these 3ghz 1GB RAM
    > computers? I need it to be about 3 cm by 3 cm all in, drawing no more
    > than one amp of current and using about 10W of power, with a JTAG port
    > on board.
    >
    > What's that, you say? There's no such thing? Well then, I guess I'll
    > have to use whatever I can get in that size, current and power
    > limitations and just do some damned elegant coding to get it to do what
    > I need.
    >
    > Lift your head from the keyboard once in a while, chum. There's more to
    > computing that desktop PCs.
    >
    > 'Chops


    Even in desktop's PCs that philosophy is utterly WRONG and leads to
    software that takes gigabytes to do the simplest thing. Of course if you
    have 2GB or 4GB of memory it doesn't matter... UNTIL YOU WANT TO RUN
    A DOZEN OF THOSE!



    --
    jacob navia
    jacob at jacob point remcomp point fr
    logiciels/informatique
    http://www.cs.virginia.edu/~lcc-win32
     
    jacob navia, Nov 9, 2007
    #11
  12. "moschops" <> wrote in message
    > wrote:
    >
    >>
    >> These days with 3ghz computers with more than 1 gbyte RAM what is so
    >> important about elegant, efficient code?
    >>

    >
    > Hey, that's great! Where can I pick up one of these 3ghz 1GB RAM
    > computers? I need it to be about 3 cm by 3 cm all in, drawing no more than
    > one amp of current and using about 10W of power, with a JTAG port on
    > board.
    >
    > What's that, you say? There's no such thing? Well then, I guess I'll have
    > to use whatever I can get in that size, current and power limitations and
    > just do some damned elegant coding to get it to do what I need.
    >
    > Lift your head from the keyboard once in a while, chum. There's more to
    > computing that desktop PCs.
    >

    Yes, but typically embedded processors do jobs which are utterly trivial.
    Like turn on a few lights in a washing machine.

    --
    Free games and programming goodies.
    http://www.personal.leeds.ac.uk/~bgy1mm
     
    Malcolm McLean, Nov 9, 2007
    #12
  13. Generic Usenet Account

    Flash Gordon Guest

    wrote, On 09/11/07 20:48:
    > On Nov 9, 2:48 pm, Ian Collins <> wrote:
    >> Generic Usenet Account wrote:
    >>> A lot of research has been done to prove that the contention that C
    >>> code is more efficient and more compact than equivalent C++ code is a
    >>> myth. My posting pertains to a slightly different aspect of this
    >>> debate. Here are my two questions:
    >>> 1) Does anyone have any information on comparison of C and C++
    >>> software written for the ARM processor?

    >> One can write piss poor inefficient code in either language, or one can
    >> write elegant efficient code in either. Programmers write code, not
    >> compilers, so there isn't anything to study or discuss.
    >>
    >> --
    >> Ian Collins.


    Please don't quote sigs, the bit typically after the "-- ".

    > These days with 3ghz computers with more than 1 gbyte RAM what is so
    > important about elegant, efficient code?


    You have a 3GHz processor with 1GB RAM in your microwave oven? Do you
    think efficiency does not matter if you have a few hundred simultaneous
    users on your server? Just to name two of the many reasons why
    needlessly inefficient code is a problem.
    --
    Flash Gordon
     
    Flash Gordon, Nov 9, 2007
    #13
  14. Generic Usenet Account

    moschops Guest

    Malcolm McLean wrote:
    > "moschops" <> wrote in message
    >> wrote:
    >>
    >>>
    >>> These days with 3ghz computers with more than 1 gbyte RAM what is so
    >>> important about elegant, efficient code?
    >>>

    >>
    >> Hey, that's great! Where can I pick up one of these 3ghz 1GB RAM
    >> computers? I need it to be about 3 cm by 3 cm all in, drawing no more
    >> than one amp of current and using about 10W of power, with a JTAG port
    >> on board.
    >>
    >> What's that, you say? There's no such thing? Well then, I guess I'll
    >> have to use whatever I can get in that size, current and power
    >> limitations and just do some damned elegant coding to get it to do
    >> what I need.
    >>
    >> Lift your head from the keyboard once in a while, chum. There's more
    >> to computing that desktop PCs.
    >>

    > Yes, but typically embedded processors do jobs which are utterly
    > trivial. Like turn on a few lights in a washing machine.
    >


    Typically. But, of course, some of them do things that are far from
    trivial. Hacks who make comments about how there's no need for elegance
    in coding can do the washing machines, and the rest of us can do the
    non-trivial stuff.

    'Chops
     
    moschops, Nov 9, 2007
    #14
  15. Generic Usenet Account

    Flash Gordon Guest

    Malcolm McLean wrote, On 09/11/07 21:54:
    > "moschops" <> wrote in message
    >> wrote:
    >>
    >>>
    >>> These days with 3ghz computers with more than 1 gbyte RAM what is so
    >>> important about elegant, efficient code?
    >>>

    >>
    >> Hey, that's great! Where can I pick up one of these 3ghz 1GB RAM
    >> computers? I need it to be about 3 cm by 3 cm all in, drawing no more
    >> than one amp of current and using about 10W of power, with a JTAG port
    >> on board.
    >>
    >> What's that, you say? There's no such thing? Well then, I guess I'll
    >> have to use whatever I can get in that size, current and power
    >> limitations and just do some damned elegant coding to get it to do
    >> what I need.
    >>
    >> Lift your head from the keyboard once in a while, chum. There's more
    >> to computing that desktop PCs.
    >>

    > Yes, but typically embedded processors do jobs which are utterly
    > trivial. Like turn on a few lights in a washing machine.


    Or image recognition in real time, of performing 42 simultaneous
    correlation calculations to detect signals well below the noise
    threshold and extract information off them that is encoded in variations
    of the bit width and simultaneously calculate the relative velocity of
    the receiver and transmitter based on the dopler shift. Or perform real
    time MPEG compression. Or...

    Well, suffice to say that vast numbers of embedded processors, including
    embedded processors in the computer I am using, the TV I am watching, my
    DVD player and my surround sound decoder are doing complex tasks
    involving a lot of computation.
    --
    Flash Gordon
     
    Flash Gordon, Nov 9, 2007
    #15
  16. Generic Usenet Account

    cr88192 Guest

    "jacob navia" <> wrote in message
    news:fh2i48$b1u$...
    > wrote:
    >> On Nov 9, 2:48 pm, Ian Collins <> wrote:
    >>> Generic Usenet Account wrote:
    >>>> A lot of research has been done to prove that the contention that C
    >>>> code is more efficient and more compact than equivalent C++ code is a
    >>>> myth. My posting pertains to a slightly different aspect of this
    >>>> debate. Here are my two questions:
    >>>> 1) Does anyone have any information on comparison of C and C++
    >>>> software written for the ARM processor?
    >>> One can write piss poor inefficient code in either language, or one can
    >>> write elegant efficient code in either. Programmers write code, not
    >>> compilers, so there isn't anything to study or discuss.
    >>>
    >>> --
    >>> Ian Collins.

    >>
    >> These days with 3ghz computers with more than 1 gbyte RAM what is so
    >> important about elegant, efficient code?
    >>
    >>

    >
    > This is the attitude that leads to shitty and bloated programs.
    >
    > Since shitty programs are the way to go (they cost less effort
    > to write, they lead to the user buying a new machine, they make the
    > economy go round) you are right of course.
    >
    > Let's write the new computer language: C# running in a virtual
    > machine written in GWBASIC.
    >
    >


    or an OS that makes a 4.4 GHz machine with 2GB ram drag along slowly as crap
    goes in and out of swap, where half my software doesn't work right, where
    even basic crap that existed before is gone, where the web browser crashes
    if one even looks at it too hard, where one discoveres that one app can
    cause another to crash, and where one can only have a few different apps
    open before the OS starts going insane and breaking...

    in this OS we can pretend that local file copies are going over the LAN or
    something given how fast they are going...

    good job that...


    it was enough in time to cause me to install go over to using XP on this box
    (even though it came with said OS in question, which is all so theoretically
    newer and better...). then one (eventually) discoveres certain other
    annoyances, namely that certain OEMs had the amazing idea of no longer
    making XP drivers for some of their hardware, causing the user to go dig
    around for something that still works...

    like, what if someone decides to go and buy one of their newer MOBOs, and
    has no intention to use said newer OS, only to find that the chipset drivers
    lack certain key components (like, for example, the onboard sound)
    apparently only available if one uses said newer shinier OS...

    and why is it that all this stuff has not long since become defacto
    standardized anyways?... I remember a short time when damn near every
    soundcard around would work if one just used SoundBlaster drivers...

    looks to me like a great conspiracy between the HW vendors and this certain
    OS vendor...


    this is the face of the future it seems...

    or such...


    >
    > --
    > jacob navia
    > jacob at jacob point remcomp point fr
    > logiciels/informatique
    > http://www.cs.virginia.edu/~lcc-win32
     
    cr88192, Nov 9, 2007
    #16
  17. Generic Usenet Account

    Guest

    On Nov 9, 5:10 pm, moschops <> wrote:
    > Malcolm McLean wrote:
    > > "moschops" <> wrote in message
    > >> wrote:

    >
    > >>> These days with 3ghz computers with more than 1 gbyte RAM what is so
    > >>> important about elegant, efficient code?

    >
    > >> Hey, that's great! Where can I pick up one of these 3ghz 1GB RAM
    > >> computers? I need it to be about 3 cm by 3 cm all in, drawing no more
    > >> than one amp of current and using about 10W of power, with a JTAG port
    > >> on board.

    >
    > >> What's that, you say? There's no such thing? Well then, I guess I'll
    > >> have to use whatever I can get in that size, current and power
    > >> limitations and just do some damned elegant coding to get it to do
    > >> what I need.

    >
    > >> Lift your head from the keyboard once in a while, chum. There's more
    > >> to computing that desktop PCs.

    >
    > > Yes, but typically embedded processors do jobs which are utterly
    > > trivial. Like turn on a few lights in a washing machine.

    >
    > Typically. But, of course, some of them do things that are far from
    > trivial. Hacks who make comments about how there's no need for elegance
    > in coding can do the washing machines, and the rest of us can do the
    > non-trivial stuff.
    >
    > 'Chops


    Jeez, I just brought it up as a topic for discussion, didn't mean for
    anyone to get nasty
     
    , Nov 9, 2007
    #17
  18. Generic Usenet Account

    red floyd Guest

    Malcolm McLean wrote:

    >>

    > Yes, but typically embedded processors do jobs which are utterly
    > trivial. Like turn on a few lights in a washing machine.
    >


    To quote Pauli.... This isn't right. It isn't even wrong.

    Lets see.... avionics, video codec, audio codec, other multimedia,
    printer engine....

    Yeah, those are just turning on a few lights.
     
    red floyd, Nov 9, 2007
    #18
  19. wrote:
    > These days with 3ghz computers with more than 1 gbyte RAM what is so
    > important about elegant, efficient code?


    Ever played a modern computer game with millions of polygons per
    level, even tens of thousands of polygons visible at the same time,
    complex physics, etc? Do you want to play that kind of game at 0.5
    frames per second or at 30 frames per second in your 3GHz computer?
     
    Juha Nieminen, Nov 9, 2007
    #19
  20. Generic Usenet Account

    Duane Hebert Guest

    > These days with 3ghz computers with more than 1 gbyte RAM what is so
    > important about elegant, efficient code?



    Missed the bit from the OP about Arm did you? Sort of topical
    for me since I've spent the last two days trying to crowbar Chinese
    fonts into an XScale Arm product.
     
    Duane Hebert, Nov 10, 2007
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matthew Louden
    Replies:
    1
    Views:
    7,004
    Scott M.
    Oct 11, 2003
  2. jm
    Replies:
    1
    Views:
    519
    alien2_51
    Dec 12, 2003
  3. Russ

    script versus code versus ?

    Russ, Jun 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,522
  4. Generic Usenet Account

    Time and memory performance of C versus C++

    Generic Usenet Account, Nov 9, 2007, in forum: C Programming
    Replies:
    69
    Views:
    1,412
    Chris Hills
    Nov 26, 2007
  5. Paul Butcher
    Replies:
    12
    Views:
    752
    Gary Wright
    Nov 28, 2007
Loading...

Share This Page