Skip to content
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

Embed static.zip in Swift code instead of downloading from remote #334

Merged
merged 3 commits into from
May 11, 2022

Conversation

kateinoigakukun
Copy link
Member

@kateinoigakukun kateinoigakukun commented May 11, 2022

This is short-term mitigation of release-process until swiftwasm/JavaScriptKit#191

@MaxDesiatov MaxDesiatov added the refactor No user-visible functionality change label May 11, 2022
@j-f1
Copy link
Member

j-f1 commented May 11, 2022

I’m also curious — what’s the most efficient way to store data in a Swift binary? Base64 data of course takes up about ⅓ more space than the equivalent raw data. In particular, are the arrays currently used for the hashes serialized to raw bytes in the binary, or would it perhaps make sense to store the encoded bytes in a C module?

@kateinoigakukun
Copy link
Member Author

kateinoigakukun commented May 11, 2022

@j-f1 Yes, Base64 is not efficient way... I initially tried to store it as byte array literal, but too many literal elements will crash the type-checker.
If we have C module to embed resources, we can use incbin. But I prefer this way for simplicity. If the inefficiency will be the problem, I will reconsider the way.
And also if we can utilize SwiftPM resources and bundler in the near future, we don't need to have static.zip at all.

@kateinoigakukun kateinoigakukun marked this pull request as ready for review May 11, 2022 15:08
Copy link
Collaborator

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we should've done this right from the beginning

@kateinoigakukun kateinoigakukun enabled auto-merge (squash) May 11, 2022 15:38
@kateinoigakukun kateinoigakukun merged commit ad9f73c into main May 11, 2022
@kateinoigakukun kateinoigakukun deleted the katei/embed-static-entrypoints branch May 11, 2022 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor No user-visible functionality change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants