Clang/llvm performance tests on FreeBSD 10.0-CURRENT

Hi all,

I recently performed a series of compiler performance tests on FreeBSD
10.0-CURRENT, particularly comparing gcc 4.2.1 and gcc 4.7.1 against
clang 3.1 and clang 3.2.

The attached text file[1] contains more information about the tests,
some semi-cooked performance data, and my conclusions. Any errors and
omissions are also my fault, so if you notice them, please let me know.

The executive summary: clang compiles mostly faster than gcc (sometimes
much faster), and uses significantly less memory.

Finally, please note these tests were purely about compilation speed,
not about the performance of the resulting executables. This still
needs to be tested.

-Dimitry

[1]: Also available at:
<http://www.andric.com/freebsd/perftest/perftest-2012-09-01a.txt>

perftest-2012-09-01a.txt (22.8 KB)

It would be cool to have an up to date version of
<http://clang.llvm.org/performance.html>. The page is currently 3+
years old.

--Sean Silva

Hi Dimitry,

I recently performed a series of compiler performance tests on FreeBSD
10.0-CURRENT, particularly comparing gcc 4.2.1 and gcc 4.7.1 against
clang 3.1 and clang 3.2.

The attached text file[1] contains more information about the tests,
some semi-cooked performance data, and my conclusions. Any errors and
omissions are also my fault, so if you notice them, please let me know.

The executive summary: clang compiles mostly faster than gcc (sometimes
much faster), and uses significantly less memory.

Finally, please note these tests were purely about compilation speed,
not about the performance of the resulting executables. This still
needs to be tested.

presumably you were compiling with optimization, but as you didn't mention
what the compiler flags were it is hard to know.

Ciao, Duncan.

...

I recently performed a series of compiler performance tests on FreeBSD
10.0-CURRENT, particularly comparing gcc 4.2.1 and gcc 4.7.1 against
clang 3.1 and clang 3.2.

...

presumably you were compiling with optimization, but as you didn't mention
what the compiler flags were it is hard to know.

Yes, I have been reminded of this by posters on the FreeBSD mailing
lists already. :slight_smile:

In any case, for all three builds, the default optimization options were
used. Basically:

1) For building the FreeBSD in-tree version of clang 3.2:

      -O2 -pipe -fno-strict-aliasing

    These are just the default FreeBSD optimization flags for building
    clang, which are probably used by the majority of users out there.
    This is the case that I was interested in particularly. The
    -fno-strict-aliasing is not really my choice, but it was introduced
    in the past by Nathan Whitehorn, who apparently saw problems without
    it. It will hopefully disappear in the future.

2) For building the FreeBSD in-tree version of gcc 4.2.1:

      -O2 -pipe

    These are the default FreeBSD optimization flags.

3) For building Boost 1.50.0:

      -ftemplate-depth-128 -O3 -finline-functions

    These are the Boost defaults for gcc-compatible compilers, from
    tools/build/v2/tools/gcc.jam.

I will add this information to the text file.

Thanks for the detailed report!

I am somewhat concerned that Clang 3.2 seems to always be 3% slower than the 3.1 version, though I guess that there performance will be tweaked prior to release as usual.

– Matthieu