I was curios how different compilers and the optimization options affect the speed of my DNA simulation program scrm. There are almost no hard computations in scrm; the bottleneck when running the program is reading and modifying memory, so there might not be much for compilers to optimize.
I benchmarked the runtime of
using the C++ version of gcc 4.8.2 and clang 3.4 with different optimization levels. The results are:
Seems that increasing the optimization level up to
O2 really helps on both
compilers, and further increasing it to
O3 only gives a minor speed boost. On
high optimization levels, g++ is about 25% faster than clang++, so using the gcc
whenever possible seems to be a good idea.