mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 02:17:58 +00:00
Small optimisation to --profile dev wasm builds (#1851)
`wasm-builder` was adjusted to default to building wasm blobs in `release` mode even when cargo is in `debug` because `debug` wasm is too slow. A side effect of this was `.compact` and `.compact.compressed` getting built when the dev is running build in `debug`, adding ~5s to the build time of every wasm runtime. I think it's reasonable to assume if the dev is running `debug` build they want to optimise speed and do not care about the size of the wasm binary. Compacting a blob has negligible impact on its actual performance. In this PR, I adjusted the behavior of the wasm builder so it does not produce `.compact` or `.compact.compressed` wasm when the user is running in `debug`. The builder will continue to produce the bloaty wasm in release mode unless it is overriden with an env var. As suggested by @koute in review, also refactored the `maybe_compact_wasm_and_copy_blobs` into multiple funuctions, and renamed things to better support RISC-V in the future. --- There is no `T-runtime` label so @KiChjang told me to put `T1-FRAME` :) --------- Co-authored-by: Koute <koute@users.noreply.github.com>
This commit is contained in:
@@ -273,9 +273,9 @@ fn build_project(
|
||||
);
|
||||
|
||||
let (wasm_binary, wasm_binary_bloaty) = if let Some(wasm_binary) = wasm_binary {
|
||||
(wasm_binary.wasm_binary_path_escaped(), bloaty.wasm_binary_bloaty_path_escaped())
|
||||
(wasm_binary.wasm_binary_path_escaped(), bloaty.bloaty_path_escaped())
|
||||
} else {
|
||||
(bloaty.wasm_binary_bloaty_path_escaped(), bloaty.wasm_binary_bloaty_path_escaped())
|
||||
(bloaty.bloaty_path_escaped(), bloaty.bloaty_path_escaped())
|
||||
};
|
||||
|
||||
crate::write_file_if_changed(
|
||||
|
||||
Reference in New Issue
Block a user