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

Initializing WASM synchronously #529

Merged
merged 2 commits into from
Jul 26, 2023

Conversation

arboleya
Copy link
Member

@arboleya arboleya commented Jul 26, 2023

Ensures that the WASM binary is initialized synchronously so that it is available right after being imported.

@arboleya arboleya self-assigned this Jul 26, 2023
@arboleya arboleya force-pushed the aa/fix/initializing-wasm-synchronously branch from 4316b88 to b2643b8 Compare July 26, 2023 14:36
@arboleya arboleya force-pushed the aa/fix/initializing-wasm-synchronously branch from b2643b8 to c765752 Compare July 26, 2023 14:37
@arboleya arboleya requested review from a team July 26, 2023 14:59
@arboleya arboleya marked this pull request as ready for review July 26, 2023 15:02
Copy link

@camsjams camsjams left a comment

Choose a reason for hiding this comment

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

Nice find!

@xgreenx xgreenx added this pull request to the merge queue Jul 26, 2023
Merged via the queue into master with commit f93366f Jul 26, 2023
31 checks passed
@xgreenx xgreenx deleted the aa/fix/initializing-wasm-synchronously branch July 26, 2023 16:51
@camsjams
Copy link

Can we publish this to npm?

@camsjams
Copy link

Actually if I read this correctly (link from description: https://github.com/rollup/plugins/tree/master/packages/wasm/#synchronous-modules)

JavaScript runtimes allow small modules (< 4KB) to be compiled synchronously.

I've never seen a wasm file this small in the wild, and the ones generated for asm here are 270k when I look at the file locally.

@arboleya
Copy link
Member Author

I saw that warning but went with it since everything worked consistently on my tests. As you suggested, I will run more in-depth tests at the file level and report back here.

If we have to force async initialization, we'll need something like:

asm.init().then(() => asm.movi(...))

@xgreenx Please hold the release a bit more, so I can get to the bottom of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants