From 32697369cf2ad259888b0ab651fd65a083d32891 Mon Sep 17 00:00:00 2001 From: Roman Kivalin Date: Sun, 12 Apr 2026 20:12:06 +0200 Subject: [PATCH] =?UTF-8?q?Optimize=20release=20binary=20size=20(16MB=20?= =?UTF-8?q?=E2=86=92=209MB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable LTO, single codegen unit, symbol stripping, and panic=abort in the release profile. Trim tokio features to only what's needed. Co-Authored-By: Claude Opus 4.6 (1M context) --- Cargo.lock | 48 ------------------------------------------------ Cargo.toml | 8 +++++++- 2 files changed, 7 insertions(+), 49 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1262928..2b0999e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1319,15 +1319,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" -[[package]] -name = "lock_api" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" -dependencies = [ - "scopeguard", -] - [[package]] name = "log" version = "0.4.29" @@ -1493,29 +1484,6 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" -[[package]] -name = "parking_lot" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-link", -] - [[package]] name = "pem" version = "3.0.6" @@ -1708,15 +1676,6 @@ dependencies = [ "yasna", ] -[[package]] -name = "redox_syscall" -version = "0.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" -dependencies = [ - "bitflags", -] - [[package]] name = "regex-automata" version = "0.4.14" @@ -1877,12 +1836,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - [[package]] name = "security-framework" version = "3.7.0" @@ -2216,7 +2169,6 @@ dependencies = [ "bytes", "libc", "mio", - "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", diff --git a/Cargo.toml b/Cargo.toml index e67fac0..f235927 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,12 @@ name = "certforge" version = "0.1.0" edition = "2024" +[profile.release] +lto = true # link-time optimization — enables cross-crate dead code elimination +codegen-units = 1 # single codegen unit — better optimization at cost of compile time +strip = true # strip debug symbols and metadata +panic = "abort" # no unwinding machinery — smaller binary, simpler code + [dependencies] # ACME instant-acme = "0.8" @@ -22,7 +28,7 @@ hex = "0.4" rustls-pki-types = "1" # Async -tokio = { version = "1", features = ["full"] } +tokio = { version = "1", features = ["macros", "rt-multi-thread", "net", "time", "process", "io-util"] } # CLI clap = { version = "4", features = ["derive"] }