Re: performance




"bjarne" <bjarne@xxxxxxxxx> wrote in message
news:1125581099.904428.309450@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Willy Denoyette [MVP] wrote;
>
>> ... it
>> was not the intention of StrousTrup to the achieve the level of
>> efficiency
>> of C when he invented C++, ...
>
> Ahmmm. It was my aim to match the performance of C and I achieved that
> aim very early on. See, for example "The Design and Evolution of C++".
>
> -- Bjarne Stroustrup; http://www.research.att.com/~bs

Hmm.. "match" is a word that say's a lot, but it doesn't say "the same"
performance, note that Hejlsberg, would probably use the same wording when
talking about "The design and Evolution of C#" ;-)

You can write "equal efficient" code in terms of performance using C++ as
you would in C, but once you start using C++ idioms you are loosing on
performance (this is not saying on efficiency)? if you really are Bjarne,
you sure know this better than anyone else and you won't be posting here
:-).
C++ code, and here I mean programs making use of C++ OO idioms like classes,
inheritance, encapsulation, exception safety etc. are less performing (not
that much) than pure C, these 'features' come at a cost, but that doesn't
mean the language is less "efficient" as a whole - au contraire mon chère,
you just loose a tiny bit on efficiency in terms of performance, and it's
that bit we shouldn't care about (I for one I don't), instead look at what
you won.
In cases that you don't need or can't or may not use these OO idioms and
language features or you need to save on every cycle ( think about device
drivers and some high performance kernel function), you will have to go
down, closer to the machine level, that is go to C (a higher level machine
code) or assembly language.


Willy.



.