bevy-website
bevy-website copied to clipboard
added section on cranelift codegen
Idk how big of a deal it is, but the configuration the blog post this PR suggests doesn't work in projects that need to support Wasm. This is because per-target profiles aren't supported by Rust You could create a new profile to handle this but then you have to specify the profile every time.
Instead it might be ideal to use rustflags for this as they can be specified per platform. Making cranelift still be used for linux but not for Wasm builds:
Cranelift
rustup component add rustc-codegen-cranelift-preview --toolchain nightly
~/.cargo/config.toml
[target.x86_64-unknown-linux-gnu]
rustflags = ["-Zcodegen-backend=cranelift", ]
Cranelift + Mold
~/.cargo/config.toml
[target.x86_64-unknown-linux-gnu]
rustflags = ["-Zcodegen-backend=cranelift", "-C", "link-arg=-fuse-ld=/usr/bin/mold"]
linker = "clang"
Thanks to this blog post for helping me discover this as an option: https://benw.is/posts/how-i-improved-my-rust-compile-times-by-seventy-five-percent
Though you wouldn't want to start shipping builds compiled with cranelift (for performance reasons) so maybe it's not a good idea to recommend that as it isn't limited to dev builds and people might forget to take it out. Personally I do my release builds in github actions so that wasn't a concern for me.
@MalekiRe if you rebase this I'll merge it in :)
Closing in favor of #1523