3 ms·
Rust binaries are also large because they copy some of C++'s bad decisions: 1) Generics are instantiated and compiled separately with types for which the gener
by cwzwarich 9y ago
Rust binaries are also large because they copy some of C++'s bad decisions:
1) Generics are instantiated and compiled separately with types for which the generics have identical behavior.
2) Functional abstraction is encouraged (not a bad thing!) and inlining heuristics are overly aggressive to compensate.
3) By default, almost every function call has to deal with the possibility that the callee might throw an exception. This is smaller than 1) and 2), but it still matters.
- inferiorhuman 9y agoExcept that rust doesn't have exceptions.
- cwzwarich 9y agoRust actually does have exceptions. Rust unwinding is implemented using LLVM/Dwarf exceptions, and can be caught using std::panic::catch_unwind: https://doc.rust-lang.org/std/panic/fn.catch_unwind.html https://doc.rust-lang.org/std/panic/fn.catch_unwind.html Idiomatic Rust doesn't use them for error handling, and they can be disabled entirely with a command-line option, but the implementation still has to deal with all of the issues that come with having exceptions.
- inferiorhuman 9y agoWell, damn.