Live data from Hacker News

The SQLite Amalgamation

sqlite.org

11–14 of 14 posts

Re: The SQLite Amalgamation

#11

> And because all code is in a single translation unit, compilers can do better inter-procedure and inlining optimization resulting in machine code that is between 5% and 10% faster. It's weird that this is still true even though compilers are now capable of whole program optimization at link time. Enabling LTO should be equivalent to compiling everything as a single translation unit but apparently it isn't. I wonder…

Because LTO is a global decision while amalgamation (or unity builds) is a local decision. As a global decision, LTO can't be too slow and is subject to heavier trade-offs. Combining files in this way is a local decision that you can just do if you know it would be a-okay and doesn't otherwise impact the whole build.

Re: The SQLite Amalgamation

#13

Earlier quoted context omitted.

I’m pretty sure the primary reason Unity builds exist is to make builds faster by eliminating massively duplicated header compiles…

You have probably confused unity builds from precompiled header files, which can be combined in the same fashion. Unity builds just mean the combined compilation of otherwise multiple files and therefore the reduction of output files to be further processed. An unqualified "unity build" typically means unity builds where inputs are source files and outputs are object files to be linked. This is most evident by consid…

This has a good comparison of compile times with unity builds and PCH https://alexanderhoughton.co.uk/blog/faster-compiling-visual...

Re: The SQLite Amalgamation

#14
post #13

Earlier quoted context omitted.

You have probably confused unity builds from precompiled header files, which can be combined in the same fashion. Unity builds just mean the combined compilation of otherwise multiple files and therefore the reduction of output files to be further processed. An unqualified "unity build" typically means unity builds where inputs are source files and outputs are object files to be linked. This is most evident by consid…

This has a good comparison of compile times with unity builds and PCH https://alexanderhoughton.co.uk/blog/faster-compiling-visual...

That page correctly mentions what is really happening: the same set of headers was used for all source files, so they were very easy to eliminate either by a single compile process with a shared cache or by having headers pre-compiled. The test header file also contains and , which are known to be very large and only sparingly used compared to others, so unity builds were unexpectedly close to PCH in terms of performance here. (Also typical mid-sized C++ projects that benefit from unity builds are not that fast to compile ;-) In any case, the distinction between unity builds and PCH should remain clear.
Post reply on HN