Re:How generics are implemented in Go 1.18
by yakubin on Tuesday March 01, 2022 @04:20PM
(#30520147)
Although monomorphization takes a significant chunk of a typical Rust compilation, it pales in comparison to LLVM codegen and execution of procedural macros. So although it's academically worthy of note, optimization-wise it's not where the focus should be. Personally, I'd like to see someday a Rust compiler which is not based on LLVM. Both Zig and Jai compile much faster when using their non-LLVM backends than when using LLVM, so Rust is not the odd one here either.
[ Parent
| on HN ]
Re:How generics are implemented in Go 1.18
by nicoburns on Tuesday March 01, 2022 @05:34PM
(#30520975)
> Although monomorphization takes a significant chunk of a typical Rust compilation, it pales in comparison to LLVM codegen
It's not the monomorphization itself that takes a long time, it's the LLVM codegen due to all the extra code being generated from duplicated function implementations. I've heard macros slow for largely the same reason, it's not the macro execution itself that's slow, it's compiling all the generated code.
Re:How generics are implemented in Go 1.18
by yakubin on Wednesday March 02, 2022 @05:47AM
(#30525921)
> I've heard macros slow for largely the same reason, it's not the macro execution itself that's slow, it's compiling all the generated code.
If that were true, the same issue would apply to hygienic macros, yet it doesn't. It's distinctly a problem with proc macros.