From 6b9640aa48d95b862b67aeaf511541ef97ddc38b Mon Sep 17 00:00:00 2001 From: YoursFunny Date: Thu, 13 Aug 2026 22:42:42 +0800 Subject: [PATCH] build: enable thin LTO and single codegen units for release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Smaller/faster production binary (verified: cargo build --release -p xmedia-bot builds clean with the new profile). panic=abort is intentionally not set — queue workers and db closures rely on JoinHandle catching panics, which abort would defeat. --- Cargo.toml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 54d5aca..6fa62d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,11 @@ members = ["crates/x-media", "crates/xmedia-bot"] resolver = "3" -# Smaller production binary; debug symbols are not shipped anyway. +# Smaller/faster production binary: strip debug symbols, link-time +# optimization across crates, and one codegen unit per crate (bigger LTO +# wins). panic=abort is intentionally NOT set: queue workers and db +# closures rely on JoinHandle catching panics, which abort would defeat. [profile.release] strip = true +lto = "thin" +codegen-units = 1