Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Like many compiled languages, Rust does dead code elimination on everything.


Right, but it depends on how the code is written, right?

If you use mostly free functions things will shake out naturally, if you use lots of dynamic dispatch you'll pull in stuff that doesn't get called.


Rust does static dispatch even for non-free functions. Only trait objects are dynamically dispatched, and most people argue they’re under-used in Rust, not overused.

If that does become a problem, there are also techniques like https://github.com/rust-lang/rust/issues/68262 too.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: