2 ms·
To expand on my other answer, part of the problem is that Rust's compile time complexity is in large part spent on knowing what code to execute, not just whethe
by PoignardAzur 4y ago
To expand on my other answer, part of the problem is that Rust's compile time complexity is in large part spent on knowing what code to execute, not just whether the code is valid.
So the compiler will spend some time inferring the types of different variables and what traits those types implement, which is necessary to know which trait methods get called, etc.
Dynamically-typed languages get to skip all this and say "my type is either a number or an object, because everything in the universe is either a number or an object", and methods are selected through dynamic dispatch (usually by storing a ton of function pointers everywhere).
Rust can't just do dynamic typing and skip the compile-time logic, though you can get close by using lots of dyn traits.