From 07fa11c9d966dcf80bbdde3947353307a6786a5d Mon Sep 17 00:00:00 2001 From: Eric Seidel Date: Thu, 2 Apr 2026 13:29:34 -0700 Subject: [PATCH] perf: add release profile to reduce binary size (#328) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * perf: add release profile to reduce binary size Add workspace-level release profile with size optimizations: - opt-level = "z" (optimize for size) - lto = true (cross-crate link-time optimization) - codegen-units = 1 (better whole-program optimization) - strip = "debuginfo" (remove debug info, preserve C API symbols) Reduces .text section by ~32% (1.9 MiB → 1.3 MiB). The .a file grows due to LTO bitcode embedding, but the final linked binary (libflutter.so) will be smaller when the engine consumes it. * chore: add codegen and debuginfo to spell check dictionary --- Cargo.toml | 6 ++++++ cspell.config.yaml | 2 ++ 2 files changed, 8 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 5819563..0946dd2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,9 @@ [workspace] members = ["library", "patch"] resolver = "2" + +[profile.release] +opt-level = "z" +lto = true +codegen-units = 1 +strip = "debuginfo" diff --git a/cspell.config.yaml b/cspell.config.yaml index 60541af..3388b9a 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -28,10 +28,12 @@ words: - cdylib - classpath - clippy + - codegen - comde - compatch - Condvar - datadir + - debuginfo - declspec - Decompressor - dllexport