by maccard · 4y ago · 0 comments
Nothing, as long as the compilation is fast. C++ compilation is not fast. The large C++ projects I've worked on over the last few years, compilation is bordering on 2 hours for a full build, and 10-60s for incremental builds. At one point, incremental changes were taking 15 minutes to link at one point (resolved by [0]). Go is a great example of fast compilation and strict typing IMO.
[0] https://devblogs.microsoft.com/cppblog/improved-linker-funda...
> In 2007, build engineers at Google instrumented the compilation of a major Google binary. The file contained about two thousand files that, if simply concatenated together, totaled 4.2 megabytes. By the time the #includes had been expanded, over 8 gigabytes were being delivered to the input of the compiler, a blow-up of 2000 bytes for every C++ source byte.
https://go.dev/talks/2012/splash.article#TOC_5.
I also hate how just adding some definition to a .h file that's only referenced in one .c (or .cpp) file will recompile loads just because the header file changed. Maybe there's ways to improve on that (ccache?), but I mostly write C to contribute to open source projects (rather than my own) and it can be an annoying wait.
A 128 cores threadripper is a great workstation to compile C++ code fast :D
(Unless a hypothetical Node.js rewrite would be comparable on speed. I wonder how it would do on memory.)
My system has a 3900x, 32GB ram, and a fast NVME SSD for reference.
The last chromium build took 1h:45m to complete. This build had LTO enabled and -j18 passed to ninja.
Without LTO it would probably be closer to an hour I think but I don't seem to have a non-LTO build in the logs.
Your estimation seems pretty accurate!
I think an even better example might be OCaml. Ocaml's compilation speed (last time I checked) was on par with Go, but it provides a much nicer (IMO) type system.