4 ms·
Have you ever tried using a unity build?
by floor_ 5y ago
Have you ever tried using a unity build?
- pjmlp 5y agoAnother nonsense, no I haven't ever bothered with it. A hack designed by those that cannot be bothered to modularize a build with binary libraries.
- maccard 5y agoIt definitely is a hack, but it's not nonsense. The speedups on large projects are significant, even on modularised ones.
- glouwbug 5y agoNot entirely. If you think about it, a resulting C binary is just data and text - it’s all compiled into a single unit of globals and functions, much like a unity build layout. Regarding optimization it allows for LTO without the need for a link time optimizer. Regarding convenience, it spares one from function prototypes and using Make or CMake. Should one use Make to speed up build times it’s as simple as tossing the unity code you’re not working on into a precompiled header; this primes the compiler for a quick compilation of the newly written code. As for design, I find unity builds resemble the design mind of a mechanical, civil, or electrical engineer - a single assembly (main.c) incorporates sub assemblies (*.c) like a CAD designer would design SolidWorks parts for a vehicle or spacecraft
- pjmlp 5y agoI rather prefer the software engineering mind to use binary libraries for what they were designed for.