5 ms·
Rust is definitely great for systems programming, and the speed is fantastic too. Take a look at some of the system utility tools on crates.io, such as ripgrep
by jph 6y ago
Rust is definitely great for systems programming, and the speed is fantastic too.
Take a look at some of the system utility tools on crates.io, such as ripgrep (like grep), bat (like cat), fd-find (like find), lolcate-rs (like locate), procs (like ps).
- CameronNemo 6y agoAll of those are MBs in size, compared to KBs for their C counterparts. Something needs to budge in Rust land for small utilities to be viable.
- deleted 6y ago[deleted]
- zozbot234 6y agoSee https://news.ycombinator.com/item?id=23496107 https://news.ycombinator.com/item?id=23496107
- forrestthewoods 6y ago> All of those are MBs in size, compared to KBs for their C counterparts. What difference does that make in the real world?
- CameronNemo 6y agoAn order of magnitude difference... my ARM boards have 16 MB SPI flash. No way I am fitting more than a single rust binary on there.
- gpm 6y agoNo way are you fitting a normal operating system on there. You can certainly compile rust to fit on there without any trouble though, you just have to try... the same way you have to try to compile any language in that sort of environment really. You can get to about 30kb while still keeping the standard library [1], you can get something with a fully featured web server in a few hundred kb [2]. [1] https://github.com/johnthagen/min-sized-rust https://github.com/johnthagen/min-sized-rust [2] https://jamesmunns.com/blog/tinyrocket/ https://jamesmunns.com/blog/tinyrocket/
- turndown 6y agoWouldn't this be a no std situation then? I do agree with the other poster that binary sizes only matter in specific cirumstances though.
- forrestthewoods 6y agoRust has partial-but-improving embedded support. I don't think you ever run any of these cmdline tools on a 16MB embedded system. And that's fine. You wouldn't run most C cmdline tools on an embedded system either.
- fouc 6y agoSometimes a binary optimized for size is faster than one optimized for speed. (Due to cache residency) Embedded systems frequently have flash size limitations in the megabytes or even kilobytes.
- lawn 6y agoThat's kind of unfair since operating systems ship with large libraries that C can dynamically link to, but rust has no such advantage.
- ben0x539 6y agoRust binaries effectively statically link a lot of code via monomorphizing generics. I may well be wrong but I don't think you could get Rust binaries down to C sizes just by separating all the dynamically linkable parts.
- CameronNemo 6y agoThat is Rust's own fault for not making their standard library ABI stable beyond a single release (and making releases so frequent). If they kept the ABI stable for just a year and gave library authors a way to do the same, distros might choose to dynamically link the stdlib, serde, clap, and other commonly used crates.