From 28a1e63f43eb99143ede08884ec5f7f43e0a834b Mon Sep 17 00:00:00 2001 From: reuben olinsky Date: Thu, 9 Jan 2025 01:18:08 -0800 Subject: [PATCH] perf: adjust compile flags for runtime performance (#314) * Tell rustc to target the CPU that it's running on; this brings the trade-off that compiled binaries may not be appropriate for execution on arbitrary target systems. * Set lto setting to fat * Configure panicking on abort (no unwinding) --- .cargo/config.toml | 3 +++ Cargo.toml | 13 ++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 35049cbc..b7ba6ce6 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,5 @@ [alias] xtask = "run --package xtask --" + +[build] +rustflags = ["-C", "target-cpu=native"] diff --git a/Cargo.toml b/Cargo.toml index 837f9006..27fa4b56 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,13 @@ [workspace] resolver = "2" -members = ["brush-shell", "brush-parser", "brush-core", "brush-interactive", "fuzz", "xtask"] +members = [ + "brush-shell", + "brush-parser", + "brush-core", + "brush-interactive", + "fuzz", + "xtask", +] default-members = ["brush-shell"] [workspace.package] @@ -42,6 +49,6 @@ struct_excessive_bools = "allow" [profile.release] strip = "debuginfo" -opt-level = "z" -lto = true +lto = "fat" codegen-units = 1 +panic = "abort"