-
Notifications
You must be signed in to change notification settings - Fork 3.4k
asm.js -> wasm migration path #5279
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
Comments
In general the plan is for migration to be just For your points:
|
Awesome, thanks for all the clarification. I wasn't aware of the async compilation requirement, but all things considered it sounds like a net positive if it's offloading work that otherwise would've blocked the main JS thread. As far as bundling, in my use case it isn't an option for these libraries to request external files at run-time, so they'd need to be distributed as single JS files (as they are now). At a minimum, the wasm would need to be embedded into the JS bundle in some way (wasm-loader just inserts a really big |
An option could be added to bundle the wasm as a typed array, yeah, like Bundling the asm.js as a fallback is basically already supported, see here. However the asm.js is kept as a side file, so for your use case, that would require another feature to bundle the asm.js as well. I suppose it could be bundled as a string perhaps. |
Cool, I wouldn't mind submitting a PR for that if you can point me in the right direction of where to start and any preferences you have on what the new command line flag(s) should look like (name(s), behaviour, arguments, etc.). As far as asm.js fallback bundling, how about something like this?
|
How about About the fallback, just doing |
Thanks, sounds good. I should be able to take care of this some time in the next week or so. As far as embedding the asm.js fallback, should that be a separate option, or should re: asm.js and AOT compilation, got it, that makes sense. In that case, how about we just set |
Good point about asm.js too. Perhaps it makes more sense to have an option Someone tried something like base64 encoding for the mem init file, and got pretty far but it stalled at some point. I don't remember the details offhand, see |
Ah yeah, As far as |
Let's just add Yeah, memory init file 2 was more complicated I guess. It tried to compress the size too. We should probably deprecate it eventually, since it was never fully finished anyhow. |
Perfect, sounds good. In that case, I'll just add the one |
As discussed in emscripten-core#5279, subresource paths are converted into base64 data URIs.
As discussed in emscripten-core#5279, subresource paths are converted into base64 data URIs.
As discussed in emscripten-core#5279, subresource paths are converted into base64 data URIs.
As discussed in emscripten-core#5279, subresource paths are converted into base64 data URIs.
As discussed in #5279, subresource paths are converted into base64 data URIs.
Is it planned for the migration path for existing asm.js projects to wasm to be as simple as adding
-s WASM=1
to an existing Makefile?That doesn't seem to be the case right now, based on a quick test with one of the asm.js libraries that I maintain, but I understand that wasm support is still early right now. It would be very convenient for everything to eventually work exactly as it does now for asm.js, without any extra required tooling or rewriting of existing code.
Specific concerns that come to mind:
--pre-js
/--post-js
support — my implementations use pre.js to start a closure and post.js to call intoModule
; does (or will) this already work as-is for wasm?Module
API — does this change at all when using wasm?wasm bundling, as in the webpack wasm-loader which simply converts wasm ES6 imports into
Uint8Array
s (we have a constraint that requires our asm libraries to each compile to a single JavaScript file)asm.js bundling — I'd be fine waiting a year or two for non-wasm-supporting browser versions to lose market share before flipping the wasm switch, but for my purposes it would really be ideal if I could just start using it today in newer browsers for the performance benefit, even at the cost of inflating the bundle size
I see in #5104 that the last two aren't currently implemented, but as a whole this seems like a separate issue since that ticket looks to be more focused on the XHR-based implementation (which explicitly won't apply to my use case).
The text was updated successfully, but these errors were encountered: