Comment by jchw
4 hours ago
Go's approach to generics is decent. It gets some of the benefits with some of the downsides. When coding in Rust, I am always so desperate for better compile times, especially for "clean" compilation because I make heavy use of Nix for various things and that comes into play a lot. (I don't run all of my builds in Nix, but I use Nix for virtual machine based integration testing for example, and that would involve doing a clean Nix build of the program.) So I guess while I get why some people were disappointed when Go didn't choose full monomorphization I appreciate their commitment to keeping fast compile times a priority. And it is certainly a hell of a lot nicer to be able to do proper generics at the language level on maps and slices in any case.
It's not generics making Rust compilation slow; Zig has monomorphized generics but is quite fast to compile.
Monomorphized generics alone don't do it, but pervasive use of monomorphized generics definitely can make binaries huge and make compile times slow. Zig may avoid it generally, but C++ doesn't.
(Even Go's generics did slow down compile times a bit at first.)
It's a bunch of things. LLVM is one of them. Zig moved away from it for reasons.