Skip to content

chore: disable incremental compilation and trim debug info for dev builds - #581

Open
vsbuffalo wants to merge 1 commit into
mainfrom
chore/dev-profile-incremental-off
Open

chore: disable incremental compilation and trim debug info for dev builds#581
vsbuffalo wants to merge 1 commit into
mainfrom
chore/dev-profile-incremental-off

Conversation

@vsbuffalo

@vsbuffalo vsbuffalo commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Cargo's dev defaults (incremental = true, debug = 2) are a good trade in
the normal regime: more files on disk for faster edit-compile cycles.
This workspace crossed a scale threshold where that stops holding on
macOS.

target/debug had reached 88 GB across ~1.67M files — 44 GB of
incremental/ and 44 GB of deps/ — against a 4.1 GB target/release.
Every Mach-O artifact in there is assessed by syspolicyd (Gatekeeper),
which sat at ~70% of one core and had accumulated 192 hours of CPU over
26 days of uptime. A debug cargo test took 6m52s at 4% CPU: not
compute-bound, but waiting on filesystem and security-assessment work
generated by the tree itself.

Deleting target/debug is what recovers the build time; this commit is
what stops it coming back. Measured cold on identical source, after that
deletion:

                    stock dev      this profile
wall                27.2s          21.2s
CPU work            176s           126s
target/debug        2.5 GB         1.1 GB
files               18,647         3,181
incremental cache   1.1 GB         0 B

The file count is the load-bearing number, since that is what is
assessed. 5.9x fewer artifacts per build, and no incremental cache to
accumulate — 1.1 GB of it regenerated from a single cold build, which is
the rate that produced 44 GB over 26 days of continuous agent builds.

line-tables-only for workspace crates and no debug info for
dependencies is Cargo's own build-performance recommendation: panic
backtraces still resolve to source locations without paying for full
DWARF. A debugging profile inheriting from dev keeps debug = 2
available for the rare case that wants a real debugger, rather than
making every CI and agent build carry metadata it does not use.

split-debuginfo is deliberately NOT changed. macOS defaults dev builds
to unpacked, packed runs dsymutil on every build, and with debug
info cut this far there is little left to pack. It wants its own
benchmark before anyone touches it.

This encodes the fix in the repo rather than relying on everyone
remembering CARGO_INCREMENTAL=0.

@vsbuffalo
vsbuffalo force-pushed the chore/dev-profile-incremental-off branch from cc42261 to 32a9130 Compare August 12, 2026 17:50
…ilds

Cargo's dev defaults (incremental = true, debug = 2) are a good trade in
the normal regime: more files on disk for faster edit-compile cycles.
This workspace crossed a scale threshold where that stops holding on
macOS.

`target/debug` had reached 88 GB across ~1.67M files — 44 GB of
`incremental/` and 44 GB of `deps/` — against a 4.1 GB `target/release`.
Every Mach-O artifact in there is assessed by `syspolicyd` (Gatekeeper),
which sat at ~70% of one core and had accumulated 192 hours of CPU over
26 days of uptime. A debug `cargo test` took 6m52s at 4% CPU: not
compute-bound, but waiting on filesystem and security-assessment work
generated by the tree itself.

Deleting `target/debug` is what recovers the build time; this commit is
what stops it coming back. Measured cold on identical source, after that
deletion:

                        stock dev      this profile
    wall                27.2s          21.2s
    CPU work            176s           126s
    target/debug        2.5 GB         1.1 GB
    files               18,647         3,181
    incremental cache   1.1 GB         0 B

The file count is the load-bearing number, since that is what is
assessed. 5.9x fewer artifacts per build, and no incremental cache to
accumulate — 1.1 GB of it regenerated from a single cold build, which is
the rate that produced 44 GB over 26 days of continuous agent builds.

`line-tables-only` for workspace crates and no debug info for
dependencies is Cargo's own build-performance recommendation: panic
backtraces still resolve to source locations without paying for full
DWARF. A `debugging` profile inheriting from dev keeps `debug = 2`
available for the rare case that wants a real debugger, rather than
making every CI and agent build carry metadata it does not use.

`split-debuginfo` is deliberately NOT changed. macOS defaults dev builds
to `unpacked`, `packed` runs `dsymutil` on every build, and with debug
info cut this far there is little left to pack. It wants its own
benchmark before anyone touches it.

This encodes the fix in the repo rather than relying on everyone
remembering CARGO_INCREMENTAL=0.
@vsbuffalo
vsbuffalo force-pushed the chore/dev-profile-incremental-off branch from 32a9130 to 1efd04c Compare August 13, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant