3 ms·
This is a bit over the top. As the rest of the thread points out, GCC in general still generates faster code than LLVM. "What does it take to get LLVM as perfo
by sanxiyn 12y ago
This is a bit over the top. As the rest of the thread points out, GCC in general still generates faster code than LLVM.
"What does it take to get LLVM as performant as GCC" talk from 2014 LLVM Developers' Meeting discusses details.
http://llvm.org/devmtg/2014-10/Slides/Molloy-LLVM-Performant-As-GCC-llvm-dev-2014.pdf http://llvm.org/devmtg/2014-10/Slides/Molloy-LLVM-Performant...
"GCC versus LLVM performance analysis reveals the LLVM inliner 1) does not inline certain hot functions unless a high threshold is provided at -O3 2) produces larger and slower code at -Os."
The problem of LLVM inliner has been known for a long time. One of the best discussion is "Optimization in LLVM" talk from 2013 European LLVM Conference.
http://www.irill.org/videos/euro-llvm-2013/carruth-hires http://www.irill.org/videos/euro-llvm-2013/carruth-hires
- darkpore 12y agoDoes it? http://imagine-rt.blogspot.co.uk/2014/12/c-compiler-benchmarks.html http://imagine-rt.blogspot.co.uk/2014/12/c-compiler-benchmar...
- phkahler 12y agoWhy yes, yes it does. There are exceptions of course, you seem to have found one. Here are some others: http://www.phoronix.com/scan.php?page=article&item=gcc49_compiler_llvm35&num=1 http://www.phoronix.com/scan.php?page=article&item=gcc49_com...
- sanxiyn 12y agoYes it does. Did you read my links? Small benchmarks can go either way, but for large codebase (especially C++) inliner is more important than just about anything else. So GCC wins, because it has better inliner.
- darkpore 12y agoYep - you evidently didn't read mine as 165 k lines of c++ isn't exactly a small benchmark :) Anecdotal, but I've seen similar improvements over g++ in my code.
- sanxiyn 12y agoThere are many measures of benchmark sizes. One important measure is size of codes that account for 99% of execution time. If your codebase is a million lines but your hotspot is a thousand lines, benchmark result is sensitive to optimization quirks and in some sense benchmark is small. More on this idea here: http://blog.pyston.org/2014/12/05/python-benchmark-sizes/ http://blog.pyston.org/2014/12/05/python-benchmark-sizes/
- darkpore 12y agoYep - you evidently didn't read mine as 165 k lines of c++ isn't exactly a small benchmark :) Anecdotal, but I've seen similar improvements over g++ in my code.
- berkut 12y agoAs the original author of that benchmark, I should point out that that was LLVM SVN (unreleased) against GCC 4.8 & 4.9 - I couldn't get GCC 5.0 SVN to build, so it's possible 5.0 will be faster again than LLVM in certain situations. However, I would also say that generally I've found LLVM is now producing faster code than GCC in most code I've tested both compilers with.
- sanxiyn 12y agoThat is very interesting, because LLVM developers themselves admit LLVM generates slower code than GCC (in average). This is plain if you read LLVM Developers' Meeting talks. I think it is completely possible that LLVM developers are using wrong benchmarks. Benchmarks are mostly SPEC and some large Google C++ codebases; in some sense both are quite atypical. But then, entire problem is to understand how typical codebases look like.
- DannyBee 12y agoI can hopefully settle this (as a developer of both). Assuming we stick to x86/x64, nowadays (literally, let's say as of January 2015) GCC and LLVM are within the noise for most people on most code (IE 1-2% of each other). You can certainly find benchmarks were LLVM does badly. Some are important to some people, some aren't. It is harder to find benchmarks where GCC does badly.
- homerowilson 12y agoNot only does gcc often produce faster running programs as referenced in the post, it has mature OpenMP support (although llvm/clang is moving pretty fast on OMP development), and has a Fortan compiler. These are important for numerical computing.