Skip to content

Commit be80bd3

Browse files
perf: enable aggressive release build optimizations (#133)
## Description Closes #132 This PR optimizes the release profile settings in `Cargo.toml`. It introduces Link-Time Optimization (LTO), reduces code generation units to a single core for maximum compiler analysis, and strips heavy debug data while maintaining human-readable panic logs. ## How Was This Tested? Tested locally inside the Devcontainer. Verified binary size differences using `ls -lh`. Drops from **6.9 MB** to **4.7 MB** (~32% reduction): <img width="795" height="66" alt="image" src="https://github.com/user-attachments/assets/5158220e-afa7-409c-b618-ce0733f37a07" /> `cargo build --release` took **~46 seconds** with build optimizations vs. **~18 seconds** with no optimizations. I used `cargo clean` before each build command. Co-authored-by: Ashar <coder3101@users.noreply.github.com>
1 parent 7168cd1 commit be80bd3

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,8 @@ const_format = "0.2"
3434

3535
[dev-dependencies]
3636
insta = { version = "1.47", features = ["yaml", "redactions"] }
37+
38+
[profile.release]
39+
strip = "debuginfo" # Removes heavy debug data but keeps function names for panic logs
40+
lto = true # Enables Link-Time Optimization for cross-crate improvements
41+
codegen-units = 1 # Maximizes LLVM optimization passes

0 commit comments

Comments
 (0)