From a2b91414439bf60a8cce6410067acba0237ec294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sat, 11 Nov 2023 19:06:10 +0100 Subject: [PATCH] Add Cranelift codegen backend to compile time optimization --- src/build-configuration.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/build-configuration.md b/src/build-configuration.md index c03154d..6744087 100644 --- a/src/build-configuration.md +++ b/src/build-configuration.md @@ -353,6 +353,21 @@ up to 50%. But the effects vary widely and depend on the characteristics of the code and its build configuration, and for some programs there is no compile time improvement. +### Codegen backend +You can use a different codegen backend to reduce compile times. Currently, +the Cranelift codegen backend is available in the nightly chanel for Linux x64 and 64-bit ARM targets. + +You can install it with this `rustup` command: +```bash +$ rustup component add rustc-codegen-cranelift-preview --toolchain nightly +``` + +And then use it with one of the following commands: +- `RUSTFLAGS="-Zcodegen-backend=cranelift" cargo +nightly build` +- `CARGO_PROFILE_DEV_CODEGEN_BACKEND=cranelift cargo +nightly build -Zcodegen-backend` + +You can find more information about this codegen backend [here](https://github.com/rust-lang/rustc_codegen_cranelift). + ## Custom profiles In addition to the `dev` and `release` profiles, Cargo supports [custom