I have a visual studio 2019 C++ project that I am converting to clang and I noticed that the clang version compiles quite a bit slower as reported by the -ftime-report
switch, which on average says that clang takes about 1700ms to compile while the VS2019 version takes only 1150ms to compile. No precompiled headers are involved.
Note that I am building the clang version directly from the command-line by calling clang++.exe
directly with the following (most relevant) flags:
-std=c++14 -g -c
The VS2019 version uses the following flags:
/permissive-
/GS
/W3
/Zc:wchar_t
/Qspectre
/Zi
/Gm-
/Od
/sdl
/Fd"x64\Debug\vc142.pdb"
/Zc:inline
/fp:precise
/D "_DEBUG"
/D "GAMECODE_EXPORTS"
/D "_WINDOWS"
/D "_USRDLL"
/D "_WINDLL"
/D "_UNICODE"
/D "UNICODE"
/errorReport:prompt
/WX-
/Zc:forScope
/RTC1
/Gd
/MDd
/std:c++14
/FC
/Fa"x64\Debug\"
/EHsc
/Fo"x64\Debug\"
/debug
/diagnostics:column
What could be causing such a big difference to make VS2019 faster? Does MsBuild do something special to speed up the compilation that my simple command-line invocation of the clang compiler doesn't do?