Nat! bio photo


Senior Mull

Twitter Github Twitch

Comparing build speed of gcc vs clang

Just a few datapoints, as this is too large for a tweet.

Build and install llvm, mulle-clang, mulle-lldb (Release)

gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0 and ld

real  11m29,759s
user  309m45,687s
sys   19m24,405s

clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) and ld

real  9m59,042s
user  277m56,055s
sys   9m25,066s

Build and install llvm, clang, lldb (Debug)

gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0 and ld

It uses too much memory on my system (32 GB per CPU available) and goes into swapping

clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) and lld

real  32m20,432s
user  235m14,486s
sys   14m7,109s

clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) and gold

real  32m44,193s
user  231m46,067s
sys   11m51,780s


Installation is a really slow process, I don’t know why. Building everything in DEBUG even with my dual CPU/ 20 core setup seems not feasible for development work.

1 Comment

A photo of René Bertin

From: René Bertin

The build overhead of the GCC suite can be reduced very significantly by deactivating the default 3-stage bootstrap build. Theoretically you'd only want to do that on systems where the compiler is known to work (= able to build itself), but in practice that's usually the case:

> configure [...] --disable-bootstrap

With that option it becomes perfectly possible to build GCC 7.3 on my humble 4-core N3150 notebook.

Re: gcc vs. clang: pity you don't show an evolution of clang build speeds. They have been decreasing steadily with each new release (though less so after clang 4). One other area where clang usually wins is size of the executables, esp. when including debug info.

Post a comment

All comments are held for moderation; basic HTML formatting accepted.

E-mail: (not published)