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

No mention here of binary size (beyond linking out to a ClickHouse blog post on the topic).

The total number of lines of code is relevant, sure, but for most practical purposes, compile times and binary sizes are more important.

I don't know the situation in Rust, but in JS land, there's a pretty clear divide between libraries that are tree-shakable (or if you prefer, amenable to dead code elimination) and those that aren't. If you stick to tree-shakable dependencies your final bundled output will only include what you actually need and can be pretty small.



> The total number of lines of code is relevant, sure, but for most practical purposes, compile times and binary sizes are more important.

Perhaps for most practical purposes, but not for security, which the article's author seems more concerned with:

> Out of curiosity I ran toeki a tool for counting lines of code, and found a staggering 3.6 million lines of rust... How could I ever audit all of that code?

Tree-shaking can't help with that.


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.




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

Search: