4 ms·
> What’s wrong with strict typing and ahead of time compilation as long as it compiles fast? Doesn’t this prevent many runtime errors that can occur in Python?
by maccard 4y ago
> What’s wrong with strict typing and ahead of time compilation as long as it compiles fast? Doesn’t this prevent many runtime errors that can occur in Python?
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-fundamentals-in-visual-studio-2019/ https://devblogs.microsoft.com/cppblog/improved-linker-funda...
- Beltalowda 4y agoGo was designed, in part, as a response to C++'s slow compile speeds. The Go compiler has gotten a bit slower over the years, but it's still pretty fast, especially when compared to C++ or Rust. > 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 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.
- snovv_crash 4y agoYou can limit the impact of this with forward declarations and only putting that is needed for the public API into the header includes. The rest can all live in the .cpp
- the_svd_doctor 4y agoC++ (especially template heavy with lots of headers and so on) is certainly not fast to compile. But 2 hours that's crazy. What sort of codebase and on what kind of machine? A 128 cores threadripper is a great workstation to compile C++ code fast :D
- MH15 4y agoChromium is known for taking hours.
- redox99 4y agoMore like an hour or less on reasonable, consumer hardware[1]. A lot less on workstation/server CPUs, or with IncrediBuild. [1] https://youtu.be/nRaJXZMOMPU?t=770 https://youtu.be/nRaJXZMOMPU?t=770
- anthk 4y agoMost people will use ccache under Unixen.
- maccard 4y agoAnd for those of us who work primarily with MSVC?
- chlorion 4y agoI am on Gentoo so I have some build time stats! 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!
- nequo 4y agoThat is true. But Chromium is not in the realm in which the compiled vs. interpreted debate is relevant. It is slow to compile, but it would also be very slow to run if it was written in Python. (Unless a hypothetical Node.js rewrite would be comparable on speed. I wonder how it would do on memory.)
- redox99 4y agoFor reference Unreal Engine 5 full build (building a lot of stuff you don't need) takes like 30 minutes on a 3950x. Typical incremental build is either 15 seconds, or a minute if I touch some popular header. For full build not only you can have a lot more cores, you can use IncrediBuild.
- wtetzner 4y ago> Go is a great example of fast compilation and strict typing IMO. 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.
- grumpyprole 4y agoOCaml is another example of fast compilation and static typing.