Issue
I write some C code by myself and I compile them by LLVM or gcc.
Nowadays, I compiled two different executable from two compiler (LLVM and gcc), and ran 100,000 times on both of them.
I found that the performance of executable from gcc always better than LLVM one.
I know they are different type of compiler even different architecture.
But why gcc always beat LLVM on performance? What is the reason?
Solution
So this is your main question
Question
Is it normal that the performance of executable compiled from gcc better than one compiled from LLVM?
Although an interesting but apparently a very broad question. Because compiler performance depends on a lot of factors.
- It depends heavily on your application.
- It depends on the underlying architecture and processor
- .........and many more factors
In addition to that, there are well established benchmarks to verify the compilers performance. With one application binary performing better is not the right benchmark and hence not an established result.
However, since application performance (program performance) is affected by the choice of the compiler, it completely makes sense that in your case you see GCC performance better than LLVM, however, it's not bound to happen always for every application.
For your further understanding, please check this:
StackOverflow post Clang vs GCC - which produces faster binaries?
Answered By - BZKN Answer Checked By - Senaida (WPSolving Volunteer)