Good to know
Good to know
Seems easily avoidable though through basic dependency analysis, though.
However, with LTO (link-time optimization), the compiler doesn't finish compiling and writes out .o/.obj files with partially processed outputs. The linker is modified to re-invoke the compiler to finish compiling all the files at once. In GCC this is available with -flto.
Actual amalgamation, where you combine many C files into one, is often not possible without modifying the files. It works for SQLite because they've made sure that their code works with amalgamation.
On a large enough codebase, being able to rebuild only what you touch and relink is the only way to get acceptable build times in dev.
The frontend jobs do not share state, so each one parses all the files in the module.
In general the parser is very fast, and the type checker tries to only type check declarations in files other than the primary file when absolutely necessary, so it's not always O(n^2). But there are pathological cases you can construct today where the type checker ends up doing too much work.