-
Notifications
You must be signed in to change notification settings - Fork 306
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
feat(avm)!: store public bytecode compressed in artifact #11193
base: master
Are you sure you want to change the base?
Conversation
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.
Nice!
Not sure if this will fly if it gets used in the browser. @Thunkar ? |
Yeah indeed
Gzipping reduces the public bytecode size ~50%. It would probably pay off to add a polyfill. WDYT? |
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.
LGTM!
Note that this will make ts code startup slower, since loadContractArtifact
gets called at the top-level in several files. So just importing a file that makes this call will incur on the gzip cost. Not sure how much it is, but if it's noticeable (especially when multiplied by all the contracts we have) we may want to make this lazy and hide it behind a property getter.
Another option would be to not compress artifacts at all, and instead rely on native browser compression (assuming the main issue here is time to download artifacts), but we'd need to check how it compares to the best
compression we're using.
Apologies for not catching this during earlier discussions, I only noticed it when I saw the gunzipSync
call written down.
That's a good idea, will check it out.
Yeah this was kind of my point in the slack discussion. I think even if we compress like in this PR, browser compression will squeeze some gains over the base64 encoding etc. I discussed with @Thunkar and he pointed me to the I'll consider all this but it might just be simpler to not compress and go with something like #11101 which would already reduce public bytecode 50%. |
Store public bytecode compressed in the artifact JSON, but uncompress when loading.
Closes #11150.