c与c ++,性能明智 [英] c versus c++, performance wise
问题描述
有没有人比较c和c ++的链接或任何信息,而且执行速度是多少?
信号处理算法将受到欢迎.. 。
谢谢
Fred
>有没有人有关于c和c ++的链接或任何信息,就执行速度而言?
信号处理算法将受到欢迎...
一般的经验法则是,如果你编写C程序并用
编译它们
C ++编译器,它们的运行速度与使用C / $
编译器编译时一样快。
如果你想编写C ++程序那不能用一种明显的方式表达
作为C程序,那么很难理解什么样的表现
比较是有意义的。
>至于执行速度是否有任何链接或任何比较c和c ++的信息?
信号处理算法将受到欢迎...
http://www.objectmentor.com/资源... tillUsingC.pdf
最终归结为你如何使用C ++。鉴于几乎所有的C / /
代码也可以在C ++编译器上编译,C ++至少可以像C一样有效。$ C ++提供了一些功能,可以让你选择在优势,可重用性和/或安全性之间实现更好的平衡
和另一方的表现。即使一些C ++特性
(如虚函数)也有运行时开销,但重要的是要知道如果你想在C中完成同样的事情,
(比如使用
开关/盒子)它也有性能损失。
-
Peter van Merkerk
peter.van.merkerk(at)dse.nl
Fred写道:有没有人比较c和c ++到目前为止的链接或任何信息作为执行速度如何?
...
由于C ++包含C作为子集(是的,有一些差异,但
它们在这个问题的背景下是非必要的),有绝对没有理由在执行速度和执行速度方面存在任何差异。存在。
它没有。
如果你要求纯粹_statistical_比较,基于
表现在C和C ++中实现类似
功能的一些现有产品中,我没有这些信息。但是再次比
,这将是可以用来证明
任何东西的统计数据......
- -
祝你好运,
Andrey Tarasevich
Brainbench C和C ++编程MVP
Has anyone a link or any information comparing c and c++ as far as
execution speed is concerned?
Signal Processing algorithms would be welcome...
Thanks
Fred
> Has anyone a link or any information comparing c and c++ as far asexecution speed is concerned? Signal Processing algorithms would be welcome...
As a general rule of thumb, if you write C programs and compile them with a
C++ compiler, they will run just as fast as if they were compiled with a C
compiler.
If you want to write C++ programs that cannot be expressed in an obvious way
as C programs, then it is hard to understand what kind of performance
comparisons are meaningful.
> Has anyone a link or any information comparing c and c++ as far asexecution speed is concerned?
Signal Processing algorithms would be welcome...
http://www.objectmentor.com/resource...tillUsingC.pdf
Eventually it boils down to how you use C++. Given that almost all C
code can also compile on C++ compilers, C++ can be at least as effecient
as C. C++ offeres also some features to give you the option to achieve a
better balance between elegancy, reusability and/or safety on one side
and performance on the other side. And even though some C++ features
(like virtual functions) have a run-time overhead, it is important to
realize that if you want to accomplish the same thing in C (like using
switch/case) it also has performance penalty.
--
Peter van Merkerk
peter.van.merkerk(at)dse.nl
Fred wrote:Has anyone a link or any information comparing c and c++ as far as
execution speed is concerned?
...
Since C++ includes C as a subset (yes, there are some differences, but
they are non-essential within the context of this question), there''s
absolutely no reason for any difference in "execution speed" to exist.
It doesn''t.
If you are asking for a purely _statistical_ comparison, based on
performance of some existing products that implement similar
functionality in C and C++, I don''t have this information. But than
again, this would be the type of statistics that can be used to prove
anything...
--
Best regards,
Andrey Tarasevich
Brainbench C and C++ Programming MVP
这篇关于c与c ++,性能明智的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!