Friday, December 2, 2011

Quick and dirty compiler tests

With point-frag, I am trying to support as many compilers and as many platform (well, Windows, Linux and soon Mac...) as I can. I hope to be able to do a benchmark from it at some point. I anyway quickly compared GCC, ICC and Clang on Linux with my small ray tracing test.
Here the numbers for my nehalem i7 (4 cores / 8 threads, triple channel memory, basically the high end chip 3 years ago). Code is compiled for SSE2 and does not use anything more recent.

GCC (4.6.2)
ray packet: 90 million rays/s
single rays: 9,9 million rays.s

ICC (12.1.0)
ray packet: 95.6 million rays/s
single rays: 10.6 million rays.s

CLANG (3.1 compiled from svn)
ray packet: 94.2 million rays/s
single rays: 9.9 million rays.s

With no surprise, the Intel compiler is slightly faster on a Intel processor than the other compilers. More surprisingly, the speed difference is quite small. Two years ago, GCC / ICC difference was about 15% on the same machine. Latest clang also outputs some fast code.

Good job open source compiler guys!

2 comments:

cbloom said...

Unfortunately I think a lot of the speed in the open source C compilers comes from more strict adherence to the "undefined" language rules and strict aliasing and stuff like that. It seems that the mainstream compiler people haven't wanted to go down that path, but if/when they do, they will get a bunch of their advantage back. MSVC in particular is still just massively better at standard/boilerplate C.

OTOH I believe LLVM will be the fastest compiler in the world some day, because it's so extensible and people keep adding new optimization rules.

phresnel said...

Thanks for posting this comparison, cool gcc and clang results. Your blog is really one of the few I should regularly visit :)