- Disables incremental linking by default. [[ https://docs.microsoft.com/en-us/cpp/build/reference/incremental-link-incrementally?view=vs-2017 | /INCREMENTAL ]] adds extra thunks in the EXE, which makes execution slower.
- Sets /MT (static CRT lib) by default instead of CMake's default /MD (dll CRT lib). The previous default [[ https://docs.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=vs-2017 | /MD ]] makes all DLL functions to be thunked, thus making execution slower (memcmp, memset, etc.)
- Adds LLVM_ENABLE_INCREMENTAL_LINK which is set to OFF by default.
I thought it'd be better if Clang / LLVM / LLD would be fast out-of-the-box, instead of people having to dig for "good" settings.
Below are timings for linking a large DLL with LLD. The type merging pass is dominant, and is affected by those two options, because of the tight merge loop. I currently have several optimisations in that loop that tend to increase the gap.
Without this patch (default cmake settings):
Type Merging: 23174 ms ( 56.9%)
With this patch (new default cmake settings):
Type Merging: 22338 ms ( 52.2%)
This is a MSVC-only change.