3 ms·
Rust does compile slower than Go, but it's not due to generics. It's mostly due to LLVM codegen and procedural macros. Go has the benefit of not relying on LLVM
by yakubin 5y ago
Rust does compile slower than Go, but it's not due to generics. It's mostly due to LLVM codegen and procedural macros. Go has the benefit of not relying on LLVM and not having procedural macros.
- codeflo 5y agoAbsolutely true. I’d add that Rust is also doing a lot more expensive optimizations in release builds.
- jcelerier 5y agoUntil recently Go didn't even use registers for passing arguments, it just put everything on the stack like in a 1965 textbook (https://go.googlesource.com/proposal/+/refs/changes/78/248178/1/design/40724-register-calling.md https://go.googlesource.com/proposal/+/refs/changes/78/24817...)
- eloff 5y agoIf you mean for function calls, I believe you're correct, not taking into account inline functions. However, for code generation Go obviously uses registers since way before the 1.0 days.
- edflsafoiewq 5y agoA lot of the IR comes from expanding huge stacks of generic functions. I don't think the issue can't be neatly partitioned up like that.
- geodel 5y agoYou are right of course about LLVM being source of slowness. In general discussion I see around is that all Rust's perf optimizations are to Rust's credit (nothing about LLVM optimization) while all woes around Rust's compile time lay at step of LLVM and Rust is not be blamed.