From c989ed08232baf413b99ccdcabefbc42e2f97baf Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Tue, 31 May 2022 17:12:15 +1000 Subject: [PATCH] Optimize release build by enabling lto, setting `codegen-units` to 1 and setting panic behavior to `abort`. On my `aarch64-apple-darwin` with `rustc 1.61.0`, this reduces the size of binary from 7.8M to 4.9M Signed-off-by: Jiahao XU --- Cargo.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 4db7ace7..eb13f15f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,3 +44,8 @@ zip = "0.6.2" [dev-dependencies] env_logger = "0.9.0" + +[profile.release] +lto = true +codegen-units = 1 +panic = "abort"