-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
optimize wasm size #836
Comments
What would be your ideal size? I doubt it can be reduced down enough to be satisfactory, so sorry in advance. WebAssembly modules tend to be large in general unfortunately. I tried running wasm-opt on the output but that only reduced the size by 5% and took quite a while, so I don't think it makes sense to run this optimizer. One thing I can do is to remove the local server code for the WebAssembly binary. It looks like it doesn't even work anyway so it can just be unconditionally removed. That brings the size down to 8mb. I'm not sure what to do to reduce it further though. |
my ideal size could be 2M-, after some search, it seems that tinygo may could reduce wasm size, but I couldn't build esbuild using tinygo successfully. |
Here is one reason (from the TinyGo docs):
There are a few different places where esbuild relies on I'm going to close this since the size was optimized and I don't think this issue is further actionable. Even if it was possible to get TinyGo to work, I don't expect it to result in a 4x size reduction. It also looks like TinyGo potentially has some pretty severe performance issues:
Edit: Feel free to post additional size reduction ideas if you have them. |
Had some more random thoughts. I don't think this is actionable but theoretically removing symbol names from the WebAssembly would shrink the size a bit. Also Go's Edit: Apparently |
remove some debug、trace、print、os specific code may help reduce size?or split the wasm to multi chunks to support concurrent download,or lazy load some part of wasm which is unlikely to be used eagely? |
is it possible to split the wasm to multi wasm chunk, then we can concurrently download multi wasm chunks, something like emscripten-core/emscripten#11753 |
esbuild is a preferct tools as a online browser bundler, but it seems that the wasm size is too large(11M), which makes it harder to put into production environment, is it possible to generate an small size wasm likes esbuild.min.wasm for production use?
The text was updated successfully, but these errors were encountered: