GCC Automatic Parallel Compilation Viability Results Help Up to 3.3x
phoronix.com
phoronix.com
Is anyone working on adding parallel linking to GCC like clang has?
Can we expect Clang to implement the same trick in a few months time?
LLVM can process multiple codegen units in parallel already, and many frontends split TUs into multiple codegen units.
LLVM is not amenable to using multiple threads to compile a single TU. The use-lists of global values (such as functions, global variables, or constant expressions) include all uses from all functions, so parallelizing on a per-function basis requires acquiring locks (or some sort of lock-free data structure) to add, remove, or iterate these lists, which would considerable overhead on a relatively common operation.
If you want more details, you can read the recent thread on llvm-dev discussing this: http://lists.llvm.org/pipermail/llvm-dev/2020-March/139606.h...
> When was the source last merged with LLVM trunk?
> This open-source release was last merged with LLVM 325000 on 2018-02-13.
There is an Energize C++ demo floating around on YouTube.
I rarely touch C / C++, but when I do I've been having to git bisect stuff. Having ccache in between has been invaluable in reducing the run time.
Perhaps it would have been better to describe it as intra-process parallel compilation in GCC, or something along those lines.
This experiment tries to make a case that something in that direction is doable and worth doing. I missed the good proof for the later, based on the analysis of state of the existing projects, however. I would personally rather consider the completely opposite direction:
In the big C++ projects, most of the functions are already present in small compilation units, and the total of the build process mostly spends time in processing the same huge set of headers for every compilation unit. Often, the whole process would be faster if more compilation units would be compiled as one(!) when the headers aren't used in a way that the semantic of them changes depending on the way in which they are used (I've heard that, of all, LLVM actually does that unfortunate thing, but I haven't spend time analyzing that myself).