TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

GCC and C vs C++ Speed, Measured

103 点作者 zorlem大约 12 年前

14 条评论

alanctgardner2大约 12 年前
Just to be clear, because this confused me at first:<p>- GCC recently switched from building their own code as C, to building as C++. At the moment they only use the subset of C++ which is C, but this affects compiler behaviour.<p>- People complained that C++ programs couldn't be compiled as efficiently as C programs, and this would make things slower.<p>- This post shows that compiling GCC as C, versus C++, does not result in an appreciable performance change. He benchmarks this by building the kernel using both versions of GCC.
评论 #5416219 未加载
评论 #5415003 未加载
baq大约 12 年前
&#62; Using stats –trim-outliers, which throws away best and worse<p>people make this mistake over and over again. there's no point in taking anything but the best time when talking about performance in a preemptive multiprocessing environment. the best time isn't an outlier, every time other than it is!
评论 #5414535 未加载
评论 #5414612 未加载
评论 #5414072 未加载
davidw大约 12 年前
FWIW, RustyRussell is this Rusty: <a href="http://en.wikipedia.org/wiki/Rusty_Russell" rel="nofollow">http://en.wikipedia.org/wiki/Rusty_Russell</a><p>Nice to see him here - "ciao" from Italy:-)
评论 #5414486 未加载
alexk7大约 12 年前
The results are what I expected and not that interesting. Compiling C as C++ usually yields the exact same native code as compiling it as C, except for some very minor differences.<p>What would be interesting is how long it now takes to compile GCC itself. For code that does not use C++ features, I also expect a very minor difference.
评论 #5415322 未加载
willvarfar大约 12 年前
Interesting aside: There are some things that are faster in C++ than C, for example the standard library sort functions are massively faster because the compiler can in-line the comparison.
评论 #5415221 未加载
评论 #5415304 未加载
adamnemecek大约 12 年前
That is one hell of a misnamed article.
评论 #5413743 未加载
lysium大约 12 年前
I don't think having a single statistics point is enough to make a judgement here. There are many different programs of which compilers are a very small and relatively rarely used subset.
eliben大约 12 年前
So 0.3% is a measurable difference and 0.1% is noise. That doesn't sound overly pragmatic to me. Benchmarking is an art, and from his setup 0.3% seems like noise as well.
tosseraccount大约 12 年前
Aren't the files already cached in memory by the time the C++ compilation happens? Wouldn't flushing memory provide a better measure?
k__大约 12 年前
I always ask myself, why are there people who put statistics without charts on the internet.
评论 #5413850 未加载
tlarkworthy大约 12 年前
So python is the fastest?
评论 #5414129 未加载
jedbrown大约 12 年前
What is the time difference to compile GCC itself?
z3phyr大约 12 年前
Linus will now use LCC
papsosouid大约 12 年前
People were complaining that the binaries would be slower? All the complaints I heard were "now it will take 10 times longer to compile gcc", not "now gcc will run slower".