This is not actually the main reason, most of the time.
Generics/monomorphization and how iterators work results in a lot of compiler bytecode that has to be churned through. More bytecode = longer compilation. It increases the size of the (debug) binaries, the debuginfo in general, causes performance issues with debug binaries in some situations unless you bump the optimization level, causes more IO, etc.
It's unlikely that many people are using Rust without using Option<T> or Result<T, U> a fair bit. Idiomatic Rust fundamentally uses a lot of generics. And a basic for loop expands into quite a lot of intermediate representation due to Iterator.
Other languages support generics, monomorphization, and iterators (e.g. Zig or D), but they're not as slow as Rust to compile, what's the reason for that?
Surac · · focus · HN ↗
What is the performance killer?
ModernMech · · focus · HN ↗
dralley · · focus · HN ↗
Generics/monomorphization and how iterators work results in a lot of compiler bytecode that has to be churned through. More bytecode = longer compilation. It increases the size of the (debug) binaries, the debuginfo in general, causes performance issues with debug binaries in some situations unless you bump the optimization level, causes more IO, etc.
ModernMech · · focus · HN ↗
dralley · · focus · HN ↗
ModernMech · · focus · HN ↗
gf000 · · focus · HN ↗
On top the borrow checker and other features are non-existent in these languages.
pjmlp · · focus · HN ↗