▲ | lingolango 3 days ago | |||||||||||||
Linux is ~1.5GB of source text and the output is typically a binary less than 100MB. That should take a few hundred milliseconds to read in from an SSD or be basically instant from RAM cache, and then a few hundred ms to write out the binary. So why does it take minutes to compile? Compilation is entirely compute bound, the inputs and outputs are minuscule data sizes, in the order of megabytes for typical projects - maybe gigabytes for multi million line projects, but that is still only a second or two from an SSD. | ||||||||||||||
▲ | bluGill 3 days ago | parent | next [-] | |||||||||||||
I don't build linux from source, but in my tests with large machines (and my C++ work project with more than 10 million lines of code) somewhere between 40 and 50 cores compile speed starts decreasing as you add more cores. When I moved my source files to a ramdisk the speed got even worse so I know disk IO isn't the issue (there was a lot of RAM on this machine so I don't expect to run low on RAM even with that many cores in use). I don't know how to find the truth, but all signs point to memory bandwidth being the issue. Of course the above is specific to the machines I did my testing on. A different machine may have other differences from my setup. Still my experience matches the claim: at 40 cores memory bandwidth is the bottleneck not CPU speed. Most people don't have 40+ core machines to play with, and so will not see those results. The machines I tested on cost > $10,000 so most would argue that is not affordable. | ||||||||||||||
| ||||||||||||||
▲ | Someone 3 days ago | parent | prev | next [-] | |||||||||||||
> 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. | ||||||||||||||
| ||||||||||||||
▲ | menaerus 3 days ago | parent | prev [-] | |||||||||||||
Output as a result is 100mb. Process of compilation accumulates magnitudes more data. Evidence is the constant memory pressure you have in 32G or 64G or even 128G systems. Now given that the process of compilation on even such high end systems take non trivial amount of time, tens of minutes, what do you think how much data bounces from and in memory? It accumulates to a lot more than what you suggest. |