Last active
October 5, 2025 03:20
-
-
Save janhohenheim/5731c11e91736bab5e9ef58c2a982c36 to your computer and use it in GitHub Desktop.
My global config.toml setup for ultra fast Rust compile times
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[unstable] | |
codegen-backend = true | |
[profile.dev] | |
# Compile using cranelift for massively faster compilation | |
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] | |
# 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] | |
rustflags = [ | |
# Compile faster | |
"-Zshare-generics=y", | |
"-Zthreads=8", | |
] | |
rustdocflags = [ | |
# Compile faster | |
"-Zshare-generics=y", | |
"-Zthreads=8", | |
] | |
[target.wasm32-unknown-unknown] | |
rustflags = [ | |
# Improve performance | |
"--cfg", | |
"web_sys_unstable_apis", | |
"-Ctarget-feature=+sign-ext,+nontrapping-fptoint", | |
# Compile faster | |
"-Zshare-generics=y", | |
"-Zthreads=8", | |
] | |
rustdocflags = [ | |
# Compile faster | |
"-Zshare-generics=y", | |
"-Zthreads=8", | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put the above in
~/.cargo/config.toml
.Requires:
rustup default nightly
rustup component add rustc-codegen-cranelift-preview --toolchain nightly
cargo install --git https://github.com/TheBevyFlock/bevy_cli --locked bevy_cli
and assumes you run your apps with
bevy run
andbevy run web -U multi-threading