This repository was archived by the owner on Oct 31, 2025. It is now read-only.
Use [profile.release.build-override] to optimize build dependencies.#437
Merged
eddyb merged 1 commit intoEmbarkStudios:mainfrom Feb 19, 2021
LykenSol:we-couldve-had-nice-things-all-along
Merged
Use [profile.release.build-override] to optimize build dependencies.#437eddyb merged 1 commit intoEmbarkStudios:mainfrom LykenSol:we-couldve-had-nice-things-all-along
eddyb merged 1 commit intoEmbarkStudios:mainfrom
LykenSol:we-couldve-had-nice-things-all-along
Conversation
khyperia
approved these changes
Feb 19, 2021
This was referenced Feb 20, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on these parts of the Cargo docs on Profiles:
I'm pretty sure that adding this to the workspace
Cargo.tomlwill cause[build-dependencies](and build scripts and proc macros) to be compiled the same way as regular dependencies, but only when building with--release(so debug mode isn't affected):Sadly, everyone using Rust-GPU would need to replicate this, so we might want to document this somewhere.
(We should probably also document that passing
--releasemakes building the shaders themselves faster)In our case, the relevant "build dependencies" are
rustc_codegen_spirvand its dependencies (e.g.rspirv), where having them optimized makes some linker passes up to 20x faster (including the new one in #414, which is why I looked into this).The overall results from this are also pretty compelling:
Assuming
sky-shadertakes somewhere betweensimplest-shaderandmouse-shader, we can see that the speedup for the final shader crate (i.e. when a lot of SPIR-V codegen and linking is involved) is around 10x, whereascoreitself doesn't get a big speedup (as most of the work is inrustcitself, which is optimized either way).