Skip to content

Commit 7dfc3bc

Browse files
sypharGuillaumeGomez
authored andcommitted
reduce debug information in dev builds for better compile times
1 parent 82e9e2d commit 7dfc3bc

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

.cargo/config.toml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1-
[profile.debug]
2-
# rustc spends an inordinate amount of time on LLVM
3-
rustflags = ["-C", "no-prepopulate-passes"]
1+
[profile.dev]
2+
# recommendation coming from
3+
# https://doc.rust-lang.org/nightly/cargo/guide/build-performance.html#reduce-amount-of-generated-debug-information
4+
# for our normal dev work, line-tables are good enough to see line numbers in backtraces.
5+
debug = "line-tables-only"
6+
# mostly for mac os, splits debug info into separate files to speed up incremental builds
7+
# https://corrode.dev/blog/tips-for-faster-rust-compile-times/#macos-only-faster-incremental-debug-builds
8+
split-debuginfo = "unpacked"
9+
10+
[profile.dev.build-override]
11+
# optimize proc macros & build scripts, make them execute faster
12+
# https://corrode.dev/blog/tips-for-faster-rust-compile-times/#avoid-procedural-macro-crates
13+
opt-level = 3
14+
15+
[profile.dev.package."*"]
16+
# no debug information for dependencies
17+
debug = false
18+
19+
[profile.debugging]
20+
# big "debugging" profile, if you need to do real interactive debugging
21+
inherits = "dev"
22+
debug = true

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010

1111
env:
1212
RUST_CACHE_KEY: rust-cache-20241114
13+
# disable incremental builds in CI, it's not needed
14+
CARGO_INCREMENTAL: 0
15+
1316

1417
jobs:
1518
sqlx:

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,6 @@ aws-smithy-runtime = {version = "1.0.1", features = ["client", "test-util"]}
124124
indoc = "2.0.0"
125125
pretty_assertions = "1.4.0"
126126

127-
[profile.dev.package."*"]
128-
opt-level = 2
129-
debug = "line-tables-only"
130-
131127
[build-dependencies]
132128
time = "0.3"
133129
md5 = "0.8.0"

0 commit comments

Comments
 (0)