2 ms·
> But this also reduces the opportunity to parallelize compilation across multiple files because they have been concatenated into fewer build units (...) Irrel
by simplotek 3y ago
> But this also reduces the opportunity to parallelize compilation across multiple files because they have been concatenated into fewer build units (...)
Irrelevant. There is always significant overhead in handling multiple translation units, and unity builds simply eliminate that overhead.
> and each unit now requires more memory to deal with the non-header parts.
And that's perfectly ok. You can control how large unity builds are at the component level.
> For some build systems and repositories, this actually increases build time.
You're creating hypothetical problems where there are none.
In the meantime, you're completely missing the main risk of unity builds: increasing the risk of introducing problems associated with internal linkage.
- tomjakubowski 3y agounity builds do often have worse performance than separate compilation for "incremental rebuilds" during development. that all depends on how the code is split up and how bad of a factor linking is. as in the article, it's best to support both