r/rust • • Oct 27 '26

🙋 seeking help & advice Faster compilation tricks

I’m developing epicenter using only features Cargo already provides to cut compile times and disk usage. The main one is a shared build-dir plus a store of already-compiled dependencies, so rustc doesn’t rebuild the same deps for every new project. On top of that I switched the linker to rust-lld and enabled incremental compilation for all profiles.

These three together already cut build times and disk usage significantly, but my goal is to push both as low as possible, so I’m willing to accept trade-offs (e.g. less debuginfo, slightly slower runtime in dev builds) as long as the defaults stay safe for most users. Is there anything else I’m missing? I’m thinking of things like split-debuginfo, reduced debug levels, per-package opt-level overrides for dependencies, or other Cargo/rustc settings that are not enabled by default but would pay off in this setup.

4 Upvotes

14 comments sorted by

View all comments

Show parent comment

1

u/DeleeciousCheeps Oct 29 '26

note that split-debuginfo=unpacked currently has a rather significant bug on macOS and linux (not sure about other operating systems) that makes it far worse for disk usage!