r/cpp • • May 10 '20

Make LLVM fast again

https://nikic.github.io/2020/05/10/Make-LLVM-fast-again.html
150 Upvotes

88 comments sorted by

View all comments

11

u/---sms--- May 10 '20

amazingly fast compiles

Totally not my experience with Clang.

Clang is almost 2 times slower than MSVC when I write no C++ code at all:

(Measure-Command { & clang++.exe -c -x c++ "C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\Windows.h" -Wno-pragma-once-outside-header }).TotalSeconds / (Measure-Command { & cl.exe /nologo /c /Tp"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\Windows.h" }).TotalSeconds
1,89302995640114

When I do, it can easily be 20x slower.

11

u/[deleted] May 10 '20

Clang on windows is not well optimized tbh. There are a lot of tricks to make it go faster - but I wish it could be faster out of the box in the future.

10

u/PoliteCanadian May 10 '20

How is running on Windows killing its performance? It is a load of compute sandwiched between some basic file IO. And it is a compiler so I would assume it is self hosting and generating basically the same code...

7

u/Myriachan May 10 '20

Compiling often involves opening and reading like 100 header files.

9

u/SkoomaDentist Antimodern C++, Embedded, Audio May 10 '20 edited May 10 '20

And a lot of software originally written on Unix makes some utterly braindead choices since those just didn’t happen to be too costly on those platforms. Just count how many total fork and exec calls across all the sub executions a typical make run performs compared to the actual number of times it needs to run the compiler.

1

u/bumblebritches57 Ocassionally Clang May 11 '20

tbf, make is basically dead these days with Cmake and Ninja be pretty common.

12

u/gcross May 11 '20

That is an odd thing to say given that CMake generates Makefiles by default on unixy platforms.