Very slow clang kernel config ..

From: Linus Torvalds
Date: Thu Apr 29 2021 - 17:53:31 EST


I haven't looked into why this is so slow with clang, but it really is
painfully slow:

time make CC=clang allmodconfig
real 0m2.667s

vs the gcc case:

time make CC=gcc allmodconfig
real 0m0.903s

Yeah, yeah, three seconds may sound like "not a lot of time, but
considering that the subsequent full build (which for me is often
empty) doesn't take all that much longer, that config time clang waste
is actually quite noticeable.

I actually don't do allmodconfig builds with clang, but I do my
default kernel builds with it:

time make oldconfig
real 0m2.748s

time sh -c "make -j128 > ../makes"
real 0m3.546s

so that "make oldconfig" really is almost as slow as the whole
"confirm build is done" thing. Its' quite noticeable in my workflow.

The gcc config isn't super-fast either, but there's a big 3x
difference, so the clang case really is doing something extra wrong.

I've not actually looked into _why_. Except I do see that "clang" gets
invoked with small (empty?) test files several times, probably to
check for command line flags being valid.

Sending this to relevant parties in the hope that somebody goes "Yeah,
that's silly" and fixes it.

This is on my F34 machine:

clang version 12.0.0 (Fedora 12.0.0-0.3.rc1.fc34)

in case it matters (but I don't see why it should).

Many many moons ago the promise for clang was faster build speeds.
That didn't turn out to be true, but can we please at least try to
make them not painfully much slower?

Linus