Hacker News new | past | comments | ask | show | jobs | submit login

> One thing I can tell you immediately about this unity build idea that is suboptimal for many codebases

to give you a data point, in my case, https://github.com/OSSIA/score (fairly mundane C++ project totaling ~360kloc in roughly 1300 .cpp files / 1800 .hpp files, split across ~15 libraries, using boost, Qt and a few other common libs), unity builds (one .cpp per library) divides the time by 5 compared to PCH.




360kloc certainly meets my definition of extraordinarily ambitious for a personal project. :) Well done you!

"Unity" builds certainly can speed up project compilation when used judiciously. This is easily shown by imagining an absurd C++ codebase where each method or function is in its own module. This would increase the overhead of parsing .h files. Any two functions that could be combined into one while keeping the h files included the same would almost certainly reduce this overhead. But I doubt your project would compile faster if all of the cc files were combined into one.


> This is easily shown by imagining an absurd C++ codebase where each method or function is in its own module

That's the musl codebase, in C. It does this in order to be able to remove unused code in a static build.

It compiles ridiculously fast. So the problem does not seem to be the amount of headers.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: