mold icon indicating copy to clipboard operation
mold copied to clipboard

[Question] `gcc+mold` is much slower than `clang+mold` in `./configure`, does it normal?

Open supechicken opened this issue 3 years ago • 5 comments

Not an issue, more like a question:

When I try to run ./configure script with CC='gcc' CFLAGS='-fuse-ld=mold', I found that it is a bit faster than -fuse-ld=gold but still much slower with CC='clang' CFLAGS='-fuse-ld=mold'

My question is does it the expected result (clang is faster than gcc)? Or there is something missing in my CFLAGS/CXXFLAGS variable?

Any answer would be appreciated :)

supechicken avatar Mar 11 '22 17:03 supechicken

(This is a request from one of our Chromebrew devs. The question is relevant because we made the mold linker the default earlier today. )

satmandu avatar Mar 11 '22 20:03 satmandu

No, it's not expected. So, configure runs various commands one at a time to identify system's capabilities. Did you observe any specific step that is way slower than the others? Or, was every step generally slower?

rui314 avatar Mar 12 '22 03:03 rui314

Almost every step that needs to involve a compiler is slower... For instance, checking for stdio.h... takes ~0.2s on clang but ~1s on gcc

supechicken avatar Mar 12 '22 13:03 supechicken

(according to config.log, all header checks are called with -c option passed to the compiler, which tells the compiler not to link it using a linker (Compile and assemble, but do not link.), maybe there is something wrong with the gcc build configuration I am using?)

supechicken avatar Mar 12 '22 13:03 supechicken

I think we need to isolate the problem. Can you run the same command as the configure script runs to see if it is indeed slower? If it's slower, then we can probably use strace to see what the process is doing.

rui314 avatar Mar 13 '22 04:03 rui314