Closed hdhoang closed 6 years ago
Cool, this is a nice improvement. The cargo bloat number doesn't mean too much in an absolute sense (since the update file is still at just ~8KB, while it says 18.5Kb in the travis log), but relative it'll help.
Need to test the target change. This is better, but i had the current setup like it was because otherwise the rust language server wouldn't work for me.
1) I didn't know about the RLS part. That sure is inconvenient for devs. Since the build target can be set in the environment as well (via CARGO_BUILD_TARGET
according to https://doc.rust-lang.org/cargo/reference/config.html#environment-variables), I will rework this into the Makefile instead.
Update: xargo doesn't use that envvar, so this route is a wash. I'll remove the commented part to avoid further confusion.
2) With opt-level="z", the DFU size goes from 8569 to 6897 bytes. Build time should also be shorter, but Travis cache and incremental compilation dwarf that effect.
I also tried out codegen-units = 1
too. DFU is 7401 bytes with Oz, 9557 bytes with O3 (contrary to my expectation about how LTO+codegen-units interact). Also, the thinlto issue in rust-lang/rust#47770 is resolved, but the DFU still grows to 15~19K, so thinlto will stay put.
With
opt-level = "z"
, .text section went down by 3.5KB from 18.5KB in travis build 140.The target commit is mostly cosmetic. It introduces a wrinkle where
cargo install
within this project will target the ARM instead of the host. I can replace this whole part with a note to that effect if you prefer.