Skip to content

Instantly share code, notes, and snippets.

@janhohenheim
Last active September 12, 2025 10:50
Show Gist options
  • Save janhohenheim/5731c11e91736bab5e9ef58c2a982c36 to your computer and use it in GitHub Desktop.
Save janhohenheim/5731c11e91736bab5e9ef58c2a982c36 to your computer and use it in GitHub Desktop.
My global config.toml setup for ultra fast Rust compile times
[unstable]
codegen-backend = true
[profile]
incremental = true
[profile.dev]
codegen-backend = "cranelift"
# If you want to attach a debugger, set this to true
debug = "line-tables-only"
# Consider compiling deps with cranelift if you want cold-compilation to be faster
[profile.dev.package."*"]
codegen-backend = "llvm"
# cranelift is `panic = abort`, so you need to compile with llvm to get `#[should_panic]` working
[profile.test.package."*"]
codegen-backend = "llvm"
# Disable cranelift for release profile
[profile.release]
codegen-backend = "llvm"
# cranelift cannot build wasm32-unknown-unknown out of the box
[profile.web]
codegen-backend = "llvm"
[build]
# Requires setting `CARGO=$(rustup which --toolchain nightly-2025-06-26 cargo)` or it breaks `Bevy CLI`:
# https://github.com/TheBevyFlock/bevy_cli/blob/main/docs/src/linter/troubleshooting.md#using-with-sccache
rustc-wrapper = "/home/hhh/.cargo/bin/sccache"
# Using a global target dir allows all projects to share incremental compilation results,
# vastly speeding up cold-compilation of new projects.
target-dir = "/home/hhh/.cargo/global-target"
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = [
"-Clink-arg=-fuse-ld=mold",
# Nightly
"-Zshare-generics=y",
"-Zthreads=8",
]
rustdocflags = [
"-Clink-arg=-fuse-ld=mold",
# Nightly
"-Zshare-generics=y",
"-Zthreads=8",
]
[target.wasm32-unknown-unknown]
# We cannot really change the linker for wasm32-unknown-unknown
rustflags = [
"--cfg",
"getrandom_backend=\"wasm_js\"",
# Nightly
"-Zshare-generics=y",
"-Zthreads=8",
]
rustdocflags = [
"--cfg",
"getrandom_backend=\"wasm_js\"",
# Nightly
"-Zshare-generics=y",
"-Zthreads=8",
]
@janhohenheim
Copy link
Author

janhohenheim commented May 20, 2025

requires

  • Linux
  • nightly
  • cranelift
  • sccache
  • mold
  • clang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment