-
Notifications
You must be signed in to change notification settings - Fork 0
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
Reduce code size on latest Rust #1
Merged
Merged
Conversation
This file contains 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
Workaround for rust-lang/rust#74947 which made each indexing location include itself as a string in the final binary, resulting in a significant code bloat in case of hqx which generates a lot of indexing via macros. Stats for a simple Wasm that reexports all 3 variants of HQX: initial size: 462076 bytes Dst wrapper with unreachable!: 250225 bytes Dst wrapper with debug_unreachable!: 190312 bytes I'm open to removing `debug_unreachable!` in favour of just `unreachable`, but I was assuming that indexing code is well-tested and the extra difference seemed nice to have.
CryZe
reviewed
Jan 21, 2021
Wow, I forgot how slow CIs other than Actions are 😀 |
Haha, yeah same. I'll just merge once the first one of the current commit is finished. Which is apparently now. |
Thanks! |
Can you please make a version tag too? I guess I could refer to a commit SHA, but it's not as pretty :) |
Alright, I tagged it as |
Thanks! |
RReverser
added a commit
to GoogleChromeLabs/squoosh
that referenced
this pull request
Jan 21, 2021
I've played a bit and added a non-invasive change to the HQX - CryZe/wasmboy-rs#1 - to work around the code size regression (rust-lang/rust#74947) introduced in the latest Rust. As a side benefit of the change, the build time also went down significantly and now takes only 1 minute altogether - including spawning Docker, fetching Cargo, building Wasm and optimising it with wasm-opt - instead of 15-20 minutes it took before. P.S. h/t @CryZe for a very quick review & publish.
RReverser
added a commit
to GoogleChromeLabs/squoosh
that referenced
this pull request
Jan 22, 2021
I've played a bit and added a non-invasive change to the HQX - CryZe/wasmboy-rs#1 - to work around the code size regression (rust-lang/rust#74947) introduced in the latest Rust. As a side benefit of the change, the build time also went down significantly and now takes only 1 minute altogether - including spawning Docker, fetching Cargo, building Wasm and optimising it with wasm-opt - instead of 15-20 minutes it took before. P.S. h/t @CryZe for a very quick review & publish.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A simple workaround for rust-lang/rust#74947 which made each indexing location include itself as a string in the final binary, resulting in a significant code bloat in case of hqx which generates a lot of indexing via macros.
Stats for a simple Wasm that reexports all 3 variants of HQX:
initial size: 462,076 bytes
Dst wrapper with unreachable!: 250,225 bytes
Dst wrapper with debug_unreachable!: 190,312 bytes
I'm open to removing
debug_unreachable!
in favour of justunreachable
, but I was assuming that indexing code is well-tested and the extra difference seemed nice to have.