-
Notifications
You must be signed in to change notification settings - Fork 79
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
Upgrade emscripten to 3.X.X? #163
Comments
I would like to do so, and can investigate. In the past I had to scrap this because the latest emscripten version at the time produced a library with significant performance degradation. |
@nrabinowitz Do you have an example branch of how you upgraded emscripten? Trying locally and seeing some major version breaks since MODULARIZE_INSTANCE is no longer supported and multi-environment builds will result in an async import. Note that https://stackoverflow.com/questions/60987493/h3-js-in-a-web-worker-document-is-not-defined would be fixed with a newer version of emscripten that adds a document defined check here emscripten-core/emscripten#12553 |
Just spent a little time looking into this. We should still be able to get a synchronous module via
This works in emscripten 3.1.30, though for some reason not with You can see my branch here: https://github.com/nrabinowitz/h3-js/tree/update-emscripten The good news - the output seems massively smaller, with gzipped file sizes going from 48Kb to 14kb. master branch
Updated emscripten
While some functions are comparable and |
Thanks for sharing the benchmarks. Agreed definitely don't want to regress performance. Out of curiosity could we output a wasm bundle? Shouldn't that be faster than a pure javascript implementation? Would be great to select a pure javascript vs wasm library. There is a workaround to fix the compilation error for Web workers and React-Native without upgrading emscripten. How would you feel about this patch?
Just manually add in the Validated that adding this check allows h3-js to be used in a web worker. |
I've been meaning to target wasm as well, I just haven't had a chance to look into this - it should be fairly straightforward, but I don't know how much the binding code would need to change (i.e. getting data into/out of wasm might be substantially different than it is for the transpiled JS). I definitely still want a pure JS bundle as the primary output, however. The library is used in a number of contexts now where only synchronous pure JS would be supported.
This looks great if that's all it takes! Do you want to submit this as a PR? I think the only hard part here is testing it - I doubt there's an easy way to add it to CI :/. |
Yea! I'll get a PR open, will figure out a good way to test. I'm thinking grepping the bundles afterwards to validate that they contain the patch. Side note, was able to benchmark |
Very interesting, thanks for the info! I'm going to open a ticket for Emscripten - we'll see if that produces any ideas. |
The current emscripten (1.38.43) is ~3 years old now. The docker container used is also deprecated https://hub.docker.com/r/trzeci/emscripten. Can we migrate to the official emscripten and use a newer version?
There are hosts of benefits and bug fixes from the past three years.
The text was updated successfully, but these errors were encountered: