Rewriting the GNU Coreutils in Rust
Rewriting the GNU Coreutils in Rust
Posted Jun 9, 2021 21:34 UTC (Wed) by Cyberax (✭ supporter ✭, #52523)In reply to: Rewriting the GNU Coreutils in Rust by ccchips
Parent article: Rewriting the GNU Coreutils in Rust
> cyberax@CybMac:/tmp$ rustc -O hello1.rs
> cyberax@CybMac:/tmp$ strip hello1 ; ls -la hello1
> -rwxr-xr-x 1 cyberax wheel 295880 9 июн 14:32 hello1
You can further reduce the size by using dynamic runtime:
> cyberax@CybMac:/tmp$ rustc -C prefer-dynamic -O hello1.rs
> cyberax@CybMac:/tmp$ ls -la hello1
> -rwxr-xr-x 1 cyberax wheel 50184 9 июн 14:29 hello1
In practice, if you are using a multicall binary then it would be BETTER to use the statically linked binary. This way the kernel will only need to cache this one binary and it will load much faster (no linking needed). This is especially helpful for scripts that invoke a lot of utilities.
