Why does `cargo build` not optimise by default?

Because optimising is slow, oh boy is it ever slow. Most of the time, you want to compile quickly so you can test changes, and rarely compile for actual release.

If you need the code to be optimised, even for debug builds, you can just turn optimisation on in the manifest.

2 Likes