compilation time 3.5 vs 3.6

Hi,

I compared compilation time with clang version 3.5 that ships with latest ubuntu and the one I built (with --enable-optimized --enable-shared). The results are:

3.5 from ubuntu: 2,60s user 0,14s system 99% cpu 2,766 total
3.6 (a33591f612fa56e7c83fe348e7ca6c32778aacb0): 3,92s user 0,14s system 99% cpu 4,078 total

Did run the same compilation few times with the same compiler to avoid some cold caches.

This means almost 50%. Any reason for this? Any other build hints for more aggressive optimizations?

Is the version that you're comparing against statically linked? The overheads of shared library use are measurable with LLVM, though probably not 50%.

David

Did you build 3.6 with assertions?

–enable-assertions Compile with assertion checks enabled (default is YES)

Best regards,

Martin

> I compared compilation time with clang version 3.5 that ships with
latest ubuntu and the one I built (with --enable-optimized
--enable-shared). The results are:

Is the version that you're comparing against statically linked? The
overheads of shared library use are measurable with LLVM, though probably
not 50%.

for both only LLVM is in shared library:

ldd /b/default/llvm/Release/bin/clang

        linux-vdso.so.1 => (0x00007ffffabd0000)
        libLLVM-3.7svn.so => /b/default/llvm/Release/bin/../lib/
libLLVM-3.7svn.so (0x00007fdaf27f8000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fdaf25a0000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007fdaf2380000)
        libedit.so.2 => /usr/lib/x86_64-linux-gnu/libedit.so.2
(0x00007fdaf2150000)
        libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5
(0x00007fdaf1f20000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fdaf1d18000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fdaf1a10000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
(0x00007fdaf1708000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
(0x00007fdaf14f0000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fdaf1128000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fdaf4568000)

ldd /usr/bin/clang

        linux-vdso.so.1 => (0x00007fff62400000)
        libLLVM-3.5.so.1 => /usr/lib/x86_64-linux-gnu/libLLVM-3.5.so.1
(0x00007f0625d88000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007f0625b68000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
(0x00007f0625860000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
(0x00007f0625648000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0625280000)
        libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6
(0x00007f0625078000)
        libedit.so.2 => /usr/lib/x86_64-linux-gnu/libedit.so.2
(0x00007f0624e48000)
        libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5
(0x00007f0624c18000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0624a10000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0624708000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f06277d0000)

Did you build 3.6 with assertions?

  --enable-assertions Compile with assertion checks enabled (default
is YES)

oops, sorry... intuitively I made the wrong assumption that
--enable-optimize would turn off assertions code

build with --disable-assertions, still the on system clang 3.5 beats :

system clang: 2,66s user 0,14s system 99% cpu 2,826 total
Release/bin/clang (git pulled latest): 3,04s user 0,13s system 98% cpu
3,206 total

Release+Asserts/bin/clang: 3,97s user 0,15s system 99% cpu 4,146 total

indeed I had also --enable-shared active

rebuilt all and now I have:
Release/bin/clang 2,93s user 0,15s system 99% cpu 3,101 total versus
system clang: 2,66s user 0,14s system 99% cpu 2,826 total

made another test and built clang with /usr/bin/clang
CC=/usr/bin/clang CXX=/usr/bin/clang++ /g/llvm.git/configure
--enable-optimized --disable-assertions

got a little closer, 2,94s user 0,13s system 99% cpu 3,090 total but
still not the total 2.82

Just a naive guess from me: Could it be due the Clang 3.5 provided by your
distributor having been built with GCC, and not with clang 3.5? What happens
if you also built it with the GCC provided by the distributor?

Bye

> rebuilt all and now I have:
> Release/bin/clang 2,93s user 0,15s system 99% cpu 3,101 total versus
> system clang: 2,66s user 0,14s system 99% cpu 2,826 total
>
> made another test and built clang with /usr/bin/clang
> CC=/usr/bin/clang CXX=/usr/bin/clang++ /g/llvm.git/configure
> --enable-optimized --disable-assertions
>
> got a little closer, 2,94s user 0,13s system 99% cpu 3,090 total but
> still not the total 2.82

Just a naive guess from me: Could it be due the Clang 3.5 provided by your
distributor having been built with GCC, and not with clang 3.5? What
happens
if you also built it with the GCC provided by the distributor?

Left in the quote what is relevant. All the results except the last one
were with gcc... however I was expecting a little faster code when built
with clang