Skip to content

Commit

Permalink
docs: add missing links to Cranelift (#273)
Browse files Browse the repository at this point in the history
* add missing links to Cranelift

* update rustc_codegen_cranelift links in docs

* s/download/install
  • Loading branch information
mwcz authored May 17, 2023
1 parent dfe92ba commit df922df
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/0.4.x/en-US/fundamentals/compilation-times.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The first step in addressing this is to figure out whether your app needs export

The next step is pretty trivial: `rustup override set nightly`. This command will set the default toolchain in your project (you have to run that command in your project directory) to `nightly`, which tends to nearly cut compile times in half! In general, the nightly compiler will be much faster than the stable one, because it uses all sorts of unstable features that improve compilation times. If you want maximum assurances though, switch back to the stable compiler before running `perseus deploy` so your production app is secured against any nightly compiler bugs (which do happen) and you get the best of both worlds.

From here, we get a little more radical. There's something called [Cranelift](), a compiler backend that can be used [for Rust]() to speed up development compilation times. Of course, the sacrifice here is runtime speed, but as long as you build with the usual compiler for production, you again get the best of both worlds. To set this up, you'll need to download the latest version of [this project](https://github.com/bjorn3/rustc_codegen_cranelift) from [here](https://github.com/bjorn3/rustc_codegen_cranelift/actions?query=branch%3Amaster+event%3Apush+is%3Asuccess) (click on the most recent action run, and then download the appropriate artifact). Then, unzip that (twice, there's a nested zip folder) and you'll get a `build/` folder, which you can put anywhere on your system. Then, add the contents of that (which should contain `cargo-clif` and `rustc-clif`) to your system's `PATH` (tutorial [for Windows](https://stackoverflow.com/a/44272417), and [for Linux/MacOS](https://linuxize.com/post/how-to-add-directory-to-path-in-linux/)).
From here, we get a little more radical. There's something called [Cranelift](https://github.com/bytecodealliance/wasmtime/tree/main/cranelift#readme), a compiler backend that can be used [for Rust](https://hacks.mozilla.org/2020/10/a-new-backend-for-cranelift-part-1-instruction-selection/) to speed up development compilation times. Of course, the sacrifice here is runtime speed, but as long as you build with the usual compiler for production, you again get the best of both worlds. To set this up, you'll need to install a [precompiled build](https://github.com/bjorn3/rustc_codegen_cranelift/#precompiled-builds) of rustc_codegen_cranelift.

With that done, any new shell (you may have to log out and back in again) will have `cargo-clif` supported as a command! You can verify this by confirming that `cargo-clif -h` results in a help page being printed. This binary acts as a drop-in replacement for `cargo`, using the Cranelift backend instead. Note that you should only ever use this for development, it's not suitable for production, where you should use the normal `cargo` instead.

Expand Down
2 changes: 1 addition & 1 deletion docs/next/en-US/fundamentals/compilation-times.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The first step in addressing this is to figure out whether your app needs export

The next step is pretty trivial: `rustup override set nightly`. This command will set the default toolchain in your project (you have to run that command in your project directory) to `nightly`, which tends to nearly cut compile times in half! In general, the nightly compiler will be much faster than the stable one, because it uses all sorts of unstable features that improve compilation times. If you want maximum assurances though, switch back to the stable compiler before running `perseus deploy` so your production app is secured against any nightly compiler bugs (which do happen) and you get the best of both worlds.

From here, we get a little more radical. There's something called [Cranelift](), a compiler backend that can be used [for Rust]() to speed up development compilation times. Of course, the sacrifice here is runtime speed, but as long as you build with the usual compiler for production, you again get the best of both worlds. To set this up, you'll need to download the latest version of [this project](https://github.com/bjorn3/rustc_codegen_cranelift) from [here](https://github.com/bjorn3/rustc_codegen_cranelift/actions?query=branch%3Amaster+event%3Apush+is%3Asuccess) (click on the most recent action run, and then download the appropriate artifact). Then, unzip that (twice, there's a nested zip folder) and you'll get a `build/` folder, which you can put anywhere on your system. Then, add the contents of that (which should contain `cargo-clif` and `rustc-clif`) to your system's `PATH` (tutorial [for Windows](https://stackoverflow.com/a/44272417), and [for Linux/MacOS](https://linuxize.com/post/how-to-add-directory-to-path-in-linux/)).
From here, we get a little more radical. There's something called [Cranelift](https://github.com/bytecodealliance/wasmtime/tree/main/cranelift#readme), a compiler backend that can be used [for Rust](https://hacks.mozilla.org/2020/10/a-new-backend-for-cranelift-part-1-instruction-selection/) to speed up development compilation times. Of course, the sacrifice here is runtime speed, but as long as you build with the usual compiler for production, you again get the best of both worlds. To set this up, you'll need to install a [precompiled build](https://github.com/bjorn3/rustc_codegen_cranelift/#precompiled-builds) of rustc_codegen_cranelift.

With that done, any new shell (you may have to log out and back in again) will have `cargo-clif` supported as a command! You can verify this by confirming that `cargo-clif -h` results in a help page being printed. This binary acts as a drop-in replacement for `cargo`, using the Cranelift backend instead. Note that you should only ever use this for development, it's not suitable for production, where you should use the normal `cargo` instead.

Expand Down

0 comments on commit df922df

Please sign in to comment.