min-sized-rust icon indicating copy to clipboard operation
min-sized-rust copied to clipboard

`-C target-cpu=native`

Open jhpratt opened this issue 5 years ago • 7 comments

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.

jhpratt avatar May 07 '20 21:05 jhpratt

But beware of codegen bug which occasionally happened. Please report issue if that happens.

tesuji avatar May 08 '20 02:05 tesuji

Also can you measure it?

tesuji avatar May 08 '20 02:05 tesuji

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.

jhpratt avatar May 08 '20 03:05 jhpratt

Like this: https://github.com/rust-lang/rust/issues/63791

tesuji avatar May 08 '20 03:05 tesuji

That's closed as fixed. Bugs happen in the compiler, that's not terribly surprising.

jhpratt avatar May 08 '20 03:05 jhpratt

  • 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.

tesuji avatar May 08 '20 03:05 tesuji

And this one may seems serious: https://github.com/rust-lang/rust/issues/64609

tesuji avatar May 13 '20 08:05 tesuji