Skip to content

Commit a2b9141

Browse files
Kobzolnnethercote
authored andcommitted
Add Cranelift codegen backend to compile time optimization
1 parent 2577b11 commit a2b9141

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/build-configuration.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,21 @@ up to 50%. But the effects vary widely and depend on the characteristics of the
353353
code and its build configuration, and for some programs there is no compile
354354
time improvement.
355355

356+
### Codegen backend
357+
You can use a different codegen backend to reduce compile times. Currently,
358+
the Cranelift codegen backend is available in the nightly chanel for Linux x64 and 64-bit ARM targets.
359+
360+
You can install it with this `rustup` command:
361+
```bash
362+
$ rustup component add rustc-codegen-cranelift-preview --toolchain nightly
363+
```
364+
365+
And then use it with one of the following commands:
366+
- `RUSTFLAGS="-Zcodegen-backend=cranelift" cargo +nightly build`
367+
- `CARGO_PROFILE_DEV_CODEGEN_BACKEND=cranelift cargo +nightly build -Zcodegen-backend`
368+
369+
You can find more information about this codegen backend [here](https://github.com/rust-lang/rustc_codegen_cranelift).
370+
356371
## Custom profiles
357372

358373
In addition to the `dev` and `release` profiles, Cargo supports [custom

0 commit comments

Comments
 (0)