2 ms·
On the contrary, commonly used Rust crates tend to be well written and well optimized (source: I have done security audits of hundreds of deps and I curate http
by pornel 4y ago
On the contrary, commonly used Rust crates tend to be well written and well optimized (source: I have done security audits of hundreds of deps and I curate https://lib.rs https://lib.rs).
Rust has a culture of splitting dependencies into small packages. This helps pull in only focused, tailored functionality that you need rather than depending on multi-purpose large monoliths. Ahead-of-time compilation + generics + LTO means there's no extra overhead to using code from 3rd party dependency vs your own (unlike interpreted or VM languages where loading code costs, or C with dynamic libraries where you depend on the whole library no matter how little you use from it).
I assume people scarred by low-quailty dependencies have been burned by npm. Unlike JS, Rust has a strong type system, with rules that make it hard to cut corners and break things. Rust also ships with a good linter, built-in unit testing, and standard documentation generator. These features raise the quality of average code.
Use of dependencies can improve efficiency of the whole application. Shared dependencies-of-dependencies increase code reuse, instead of each library rolling its own NIH basics like loggers or base64 decode, you can have one shared copy.
You can also easily use very optimized implementations of common tasks like JSON, hashmaps, regexes, cryptography, or channels. Rust has some world-class crates for these tasks.