4 ms·
opt-level z would not be a reasonable default: you should normally optimise for speed, not binary size. lto and codegen-units=1 have a huge compile time cost.
by chrismorgan 3y ago
opt-level z would not be a reasonable default: you should normally optimise for speed, not binary size.
lto and codegen-units=1 have a huge compile time cost. For release for general distribution you should tend to favour them, but the release profile isn’t just about that activity (especially because debug/opt-level<2 is often just too slow to use while developing). You commonly want to create another profile for production distribution.
Abort on panic changes runtime behaviour by stopping you from catching panics, which will completely break some programs, and harm the failure mode of others, so that e.g. one defective route on a web server will suddenly take the entire website down for everyone (or, if you have a supervisor that can restart the server, at least disrupt it for everyone).
- flohofwoe 3y ago> you should normally optimise for speed, not binary size IME optimize for speed vs size usually isn't as clear cut as the name says though, sometimes smaller code does indeed run faster, but in most cases I've seen there's not much of a difference between -O3, -O2, -Os and -Oz.
- kibwen 3y agoWeirdly, most of the time I find that -O3 produces smaller binaries than -Oz.