▲ | Someone 3 days ago | |
> So why does it take minutes to compile? I’m not claiming anything about it being I/O or compute bound, but you are missing some sources of I/O: - the compiler reads many source files (e.g. headers) multiple times - the compiler writes and then reads lots of intermediate data - the OS may have to swap out memory Also, there may be resource contention that makes the system do neither I/O nor compute for part of the build. | ||
▲ | lingolango 3 days ago | parent | next [-] | |
Tried building sqlite amalgamation just now. Input: single .c file 8.5MB. Output: 1.8MB object file. Debug build took 1.5s. Release build (O2) took about 6s. That is about 3 orders of magntiude slower than what this machine is capable of in terms of IO from disk. | ||
▲ | sgerenser 3 days ago | parent | prev [-] | |
The fact that something doesn’t scale past X cores doesn’t mean that it is I/O bound! For most C++ toolchains, any given translation unit can only be compiled on a single core. So if you have a big project, but there’s a few files that alone take 1+ minute to compile, the entire compilation can’t possibly take any less than 1 minute even if you had infinite cores. That’s not even getting into linking, which is also usually at least partially if not totally a serial process. See also https://en.m.wikipedia.org/wiki/Amdahl%27s_law |