From 7505007d8c1e38e23be5984f3984bb55a0d77bfa Mon Sep 17 00:00:00 2001 From: Mark B Date: Sat, 14 Mar 2026 22:57:33 -0400 Subject: [PATCH] release-fast profile Introduces a `release-fast` profile that inherits from `release` but uses thin LTO and 8 codegen units instead of full LTO + 1, cutting link time significantly while remaining fast enough for integration testing. Documents usage in CONTRIBUTING.md. Co-authored-by: Claude Sonnet 4.6 --- CONTRIBUTING.md | 10 ++++++++++ Cargo.toml | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1f377397..2aa3301a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,6 +56,16 @@ Tests that require a real LLM key will skip gracefully if the env var is absent. cargo build --workspace ``` +### Fast Release Build (for development) + +The default `--release` profile uses full LTO and single-codegen-unit, which produces the smallest/fastest binary but is slow to compile. For iterating locally, use the `release-fast` profile instead: + +```bash +cargo build --profile release-fast -p openfang-cli +``` + +This cuts link time significantly (thin LTO, 8 codegen units, `opt-level=2`) while still producing a binary fast enough to run integration tests against. Use `--release` only for final binaries or CI. + ### Run All Tests ```bash diff --git a/Cargo.toml b/Cargo.toml index fb67a8eb..b08de6c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -150,3 +150,10 @@ lto = true codegen-units = 1 strip = true opt-level = 3 + +[profile.release-fast] +inherits = "release" +lto = "thin" +codegen-units = 8 +opt-level = 2 +strip = false