diff --git a/content/learn/quick-start/getting-started/setup.md b/content/learn/quick-start/getting-started/setup.md index 64bd3e37f7..1f00bbd58b 100644 --- a/content/learn/quick-start/getting-started/setup.md +++ b/content/learn/quick-start/getting-started/setup.md @@ -291,6 +291,37 @@ channel = "nightly" For more information, see [The rustup book: Overrides](https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file). +#### Cranelift + +This uses a new nightly-only codegen that is about 30% faster at compiling than LLM. +It currently works best on Linux. + +To install cranelift, run the following. +``` +rustup component add rustc-codegen-cranelift-preview --toolchain nightly +``` + +To activate it for your project, add the following to your `.config/cargo.toml`. +```toml +[unstable] +codegen-backend = true + +[profile.dev] +codegen-backend = "cranelift" + +[profile.dev.package."*"] +codegen-backend = "llvm" +``` + +This enables faster compiles for your binary, but builds Bevy and other dependencies with the more-optimized LLVM backend. See the [cranelift setup guide](https://github.com/rust-lang/rustc_codegen_cranelift#download-using-rustup) for +details on other ways in which cranelift can be enabled. The installation process for Windows is a bit more involved. Consult the linked documentation for help. +MacOS builds can currently crash on Bevy applications, so you should still wait a bit before using cranelift on that system. + +While cranelift is very fast to compile, the generated binaries are not optimized for speed. Additionally, it is generally still immature, so you may run into issues with it. +Notably, Wasm builds do not work yet. + +When shipping your game, you should still compile it with LLVM. + #### Generic Sharing Allows crates to share monomorphized generic code instead of duplicating it.