-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Options for future asm.js support #8085
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
I'd be fine with dropping validating asm.js output. Evergreen browsers grok wasm, and versions of IE and Safari tied to old operating systems don't optimize for the validating mode. I'm actually already breaking validation in our codec modules by transforming to replace Math.imul in some hot code paths that don't need the proper overflow behavior of the polyfill. :) Would not object at all to more general benefits we can get; smaller function tables would be nice. There might be folks with libraries who prefer to ship .js rather than .js+.wasm who would miss the performance bump on evergreen browsers, but I wouldn't be surprised to see the browser optimizations go away some day too so they should be nudged towards Wasm. |
Having a third "fake-asm.js" build mode for really old browsers is a really appealing idea. Are you referring to this being something different than the current -s ASM_JS=2 option that runs Closure on the asm.js output? In such scheme, options 2) and 3) can come from the same build even, and the builds can share the same
Hmm, this is surprising? Don't we currently have all three, with
I think in order to answer this, there should be an audit of Firefox, Chrome and Safari version history to figure out the version range that added first impactful asm.js optimizations, and the first version that added wasm support. Things are also muddied a bit by wasm multithreading. In order to cut down the number of fallbacks one has to maintain, wasm singlethreading may become the uninteresting in-between, and for some users instead the only shipping configurations might be asm.js singlethreading and wasm multithreading.
I am not sure if it is mutually exclusive to support first two, or first and last. These kinds of non-asm.js validating optimizations look like various small things, |
Yeah, something different I think. ASM_JS=2 mode is just "write almost asm instead of use asm, and allow emitting stuff like memory growth and simd which won't validate anyhow". But it doesn't take advantage of the possible optimizations there. There is also So yeah, I wasn't accurate when I said that we support just wasm and validating asm.js. What I meant was, we've focused on optimizing wasm and validating asm.js Instead, if we replace our focus with wasm and non-validating "asm.js", I think we may gain some big benefits.
For chrome and firefox, auto-updating prevents older versions from being a significant part of market share. StatCounter has desktop market share details - they don't even show old enough versions of chrome from before it did asm.js validation, it gets into tiny fractions at that point. Firefox is even more so, since it started validating earlier (and Firefox LTS is also well in that range too). I'm less sure about mobile, StatCounter and others don't seem to offer a breakup into browser versions. Safari never had asm.js validation, so any change we do here would just help it.
Yeah, some of these things, like Maybe I should mention some more thoughts I had here. One option we might consider is to implement an "almost asm.js" pipeline using the LLVM wasm backend + wasm2asm + JS optimization passes. The benefits of that would be
Other benefits aside from better generated JS code:
|
Oh, @dschuff reminded me that actually chrome had wasm before it had asm.js validation! (the validation was built on top of the wasm compiler code, in fact) Given that, the only risk of asm.js validation mattering (in a place where wasm is not supported) is for Firefox and Edge. Given their market share, and where their users are (desktop for both, and Firefox has excellent auto-updating there), the risk of asm.js validation mattering is really extremely small. |
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant. |
This has been implemented as the wasm2js path, and is stable. |
We currently support asm.js and wasm, and intend to support both for the long term. I had some ideas about options for how exactly we do that for asm.js. Consider that
In other words, we can in theory support 3 things:
We currently support the first 2. Maybe supporting the first and the last would be better: smaller code for "asm.js", and anyhow almost all browsers that benefit from asm.js validation can also run wasm. In other words, asm.js with validation was a brief intermediary step - how much do we still care about it? If we do, is the speed worth the code size downsides?
Why can we make "asm.js" that is smaller and faster than validating asm.js? For example,
TABLE[x & 511]
=>TABLE[x]
. This is smaller and likely faster.&&
, so we end up doing stuff likex ? y : 0
instead ofx && y
(smaller, but need to measure if it's faster).Thoughts?
cc'ing some people that I know use the non-wasm path: @juj @Brion
The text was updated successfully, but these errors were encountered: