emscripten-core / emscripten-core/emscripten

lz4 compressed wasm with ``-s SINGLE_FILE=1``

Open
#16,056 8 comments 3 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 6h
Merged PRs (30d)
109

Description

It would be cool, if emscripten provided the option to compress a wasm binary with LZ4 before base64-encoding and embedding it via ``-s SINGLE_FILE=1``.

Context: The solidity compiler https://github.com/ethereum/solidity has been publishing js/wasm binaries built with ``-s SINGLE_FILE=1`` for a while now. However, the binaries have grown to over 20MB in size and require a lot of bandwidth and long loading times. We realized that lz4 compressing the wasm binary before base64 encoding will reduce the size to ~8MB and loading times actually become *faster*, since base64 decoding is slow in comparison.
So we're working on doing this manually, but we were wondering, if this may be something that's generally useful and may be a nice feature in emscripten itself. (Especially since we realized that you support something very similar with ``LZ4 = 1`` already, just not applied to the embedded wasm binary)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.