min-sized-rust
min-sized-rust copied to clipboard
`-C target-cpu=native`
By using RUSTFLAGS="-C target-cpu=native", the resulting binary will be far less portable, but it can reduce the binary size a fair amount.
But beware of codegen bug which occasionally happened. Please report issue if that happens.
Also can you measure it?
I haven't heard of any issues with codegen, but I may just not be aware.
I'm not sure where this would be inserted, which would obviously affect the measurement. It's relatively trivial to do so, however.
Like this: https://github.com/rust-lang/rust/issues/63791
That's closed as fixed. Bugs happen in the compiler, that's not terribly surprising.
- https://github.com/rust-lang/rust/issues/48464 I don't know current status of it
- https://github.com/rust-lang/rust/issues/63959
I just want to add a small note to raise awareness for using target-cpu=native.
And this one may seems serious: https://github.com/rust-lang/rust/issues/64609