Over a million developers have joined DZone.

Compiler Comparison: GCC 4.7 vs CLang 3.1 on eddic

DZone's Guide to

Compiler Comparison: GCC 4.7 vs CLang 3.1 on eddic

· Performance Zone
Free Resource

Evolve your approach to Application Performance Monitoring by adopting five best practices that are outlined and explored in this e-book, brought to you in partnership with BMC.

Now that eddic can be compiled with CLang, I wanted to compare the differences in compilation time and in performances of the generated executable between those two compilers. The tests are done using GCC 4.7.2 and CLang 3.1 on Gentoo.

Compilation Time

The first thing that I tested has been the compilation time of the two compilers to compile eddic with different flags. I tested the compilation in debug mode and with -O2 and -O3.


The most interesting fact in these results is that CLang is much faster than GCC. It takes twice less times to compile eddic with CLang in debug mode than with GCC. The impact on optimizations on CLang’s compilation is also more important than on GCC. For both compilers, -O3 does not seems to add a lot of overhead.

Runtime performances

Then, I tested the performances of the generated executable. I tested it on three things, the whole test suite and two test cases that I know are the slowest for the EDDI Compiler. For each case, I took the slowest value of 5 consecutive executions.


The difference are very small. In -02, GCC performs a bit better, but in -O3, the performances are equivalent. I was a bit disappointed by the results, because I thought that there would be higher differences. It seems that CLang is not as far from GCC that some people would like to say. It also certainly depends on the program being compiled.


It is clear that CLang is much faster than GCC to compile eddic. Moreover, the performances of the generated executable are very similar.

I will continue to use CLang as my development compiler and switches between the two when I’m doing performances benchmarking. I will try to update the benchmark once new versions of GCC / CLang are available.

Learn tips and best practices for optimizing your capacity management strategy with the Market Guide for Capacity Management, brought to you in partnership with BMC.


Published at DZone with permission of Baptiste Wicht, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}