-
Notifications
You must be signed in to change notification settings - Fork 1.1k
wasm-builder: Only overwrite wasm files if they changed #10448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| title: 'wasm-builder: Only overwrite wasm files if they changed' | ||
| doc: | ||
| - audience: Runtime Dev | ||
| description: |- | ||
| When running two different `cargo` commands, they may both compile the same wasm files. When the second `cargo` command produces the same wasm files, we are now not gonna overwrite it. This has the advantage that we can run the first command again without it trying to recompile the project. Right now it would lead to the wasm files always getting recreated, which is wasting a lot of time :) | ||
| crates: | ||
| - name: substrate-wasm-builder | ||
| bump: patch |
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm can the following happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If blob B is the same as blob A, then should it be fine to return compressed and compact from run 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. If B is the same as A, the compressed version of A should be the same as the compressed version of B.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I think what @skunert meant is that we would return compressed binary from run 1 if even if
needs_compactis false.Step 2:
bloaty_changed = false(bloaty B is identical to A, so no copy happened)needs_compact = false(debug mode)compact_or_compressed_exists = true(from step 1)=>
should_regenerate = falsewhich results in returning:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if we would return the compressed one, it would be fine. The compressed one is only special cased, to speedup debug builds and not more. It doesn't do any harm.
Also we have
debug/wbuildandrelease/wbuild. So, ifneeds_compactchanges, we are actually in a different folder and we can not seeneeds_compact = truewhen we haveneeds_compact = false.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that makes sense. Maybe we could have some comment in the code pointing that out. It's quite convoluted.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I meant that blob B is different from A.
In run 2 lets say
needs_compactis false, so we would not rebuild compressed and compact wasm files. So the ones from run 1 would stay right?In run 3 we just check that bloaty is the same, which it is. But the compact and compressed blobs are still from run 1 which was different. Then we would return the compressed blobs from run 1 in run 3.
But maybe I am missing something here 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Read what I wrote here: #10448 (comment)
TDLR:
needs_compactis always the same in the folder where we output these files.