-
Notifications
You must be signed in to change notification settings - Fork 14
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
Wasm #15
base: main
Are you sure you want to change the base?
Wasm #15
Conversation
Hey Charlie, if you link in wabt.js (wat2wasm) you can generate wasm on the fly and assemble it, instead of just calling wasm functions. The overhead of popping in an out of wasm is often quite high. |
Hey Abram, Hope all is well with you! There's only one call to wasm per callback block... I don't think it can get any lower than this :) The wat2wasm happens during the gulp build... which I just realized I haven't committed. Will do so now! |
here's the gulpfile (such as it is): https://github.com/charlieroberts/genish.js/blob/wasm/gulpfile.js ... and here's the relevant part of the audioworklet: https://github.com/charlieroberts/genish.js/blob/wasm/src/module.js#L70 It's gonna take me a bit to clean up this branch, I probably should have just used a new repo. |
last but not least I updated the README in the wasm branch to include a bit more description / motivation: https://github.com/charlieroberts/genish.js/blob/wasm/README.md There's also a link to a wasm-enabled playground there if you want to try it out. |
I just found this fantastic essay on js > wasm (and vice-versa) in Firefox from a few years back... turns out it's not as slow as it was originally: https://hacks.mozilla.org/2018/10/calls-between-javascript-and-webassembly-are-finally-fast-🎉/ |
That's a really interesting FF article about the performance of wasm. Yeah wasm is pretty close to the JIT'd code in FF. FF does wasm well. Last year when I tested Wasm versus JS, the gains or similar performance was mostly apparent when you stayed in wasm long enough or used floating point operations. https://github.com/abramhindle/impractical-wasm (video: https://www.youtube.com/watch?v=VkpBLEif6B8 ). I'm glad to see that you're having a lot of success porting it. |
oh nice, that's a much better guide to doing this than most of the ones I looked at when I was trying to figure out how this all worked. thanks for sharing! |
No description provided.