5 ms·
> As an example, in my desktop, it takes ~25min to compile a Debug version of LLVM, but ~23min to compile a Release version. oh I think I know what might cause
by mshockwave 2y ago
> As an example, in my desktop, it takes ~25min to compile a Debug version of LLVM, but ~23min to compile a Release version.
oh I think I know what might cause this: TableGen. The `llvm-tblgen` run time accounts for a good chunk of LLVM build time. In a debug build `llvm-tblgen` is also unoptimized, hence the long run time generating those .inc / .def files. You can enable cmake variable `LLVM_OPTIMIZED_TABLEGEN` to build `llvm-tblgen` in release mode while leaving the rest of the project in debug build (or whatever `CMAKE_BUILD_TYPE` you choose).
- baziotis 2y agoTIL that LLVM_OPTIMIZED_TABLEGEN exists, thanks! Unfortunately, it didn't make the build any faster on my machine.
- yshui 2y agoi'd say it's mostly due to linking. the debug info generated is absolutely enormous.
- vient 2y agoLLVM_USE_SPLIT_DWARF may help with this, some recent measurements: https://www.tweag.io/blog/2023-11-23-debug-fission/#an-example-at-scale-building-llvm https://www.tweag.io/blog/2023-11-23-debug-fission/#an-examp...
- delta_p_delta_x 2y agoThe biggest factor in improving LLVM compile/link times is sheer RAM capacity. LLVM compilation is extremely voracious with memory and the more you have the faster it is; otherwise, much time is spent swapping in and out of disk. I've been compiling it with MSVC on Windows and the swap file after an LLVM compile balloons to ~60 GB. I inserted a couple more sticks to bring my 32 GB to 64 GB and my compile times shortened significantly (I don't have exact stopwatch times right now).
- almostgotcaught 2y agoUse clang-cl instead - way better RAM usage profile and way faster too - I'm talking like 50% reduction.
- almostgotcaught 2y ago> good chunk of LLVM build time Nah no way it's more than 5%. 5% is definitely a chunk but not big enough that if you made it completely vanish I'd notice. I rebuild LLVM with no cache many times a day (debug, release, all targets, no targets, etc). Debug build takes longer because of all the symbols - LLVM has some enormous symbols due to templating hijinks. Protips for speeding up building LLVM: 1. LLVM_TARGETS_TO_BUILD=host 2. LLVM_ENABLE_PROJECTS only what you're interested in (do you really care about lld or flang whatever?) 3. Use clang/lld instead of gcc - way better RAM usage 4. Use ccache 4. Disable tests