pyodide / pyodide/pyodide-pack
Explore the size reduction of Emscripten shared objects
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 48
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
There are a bunch of tools we could run over the object files in wheels for this, but wasm-opt and wasm-dce come up in search results in the first go. I don't know enough about how to do this, so I'm documenting some resources here for our reference.
- https://hacks.mozilla.org/2018/01/shrinking-webassembly-and-javascript-code-sizes-in-emscripten/
- https://github.com/xtuc/webassemblyjs/tree/master/packages/dce
- https://github.com/gonowa/wasm-opt
- https://kripken.github.io/emscripten-site/docs/optimizing/Optimizing-Code.html#code-size
- https://webassembly.github.io/wabt/doc/wasm-strip.1.html
Otherwise, I'm sure we are building everything in release mode, LTO, etc. and use only the required amount of INITIAL_MEMORY already. Build backends are not always responsible for stripping away binary information, and while some do support calling strip over the .so files (scikit-build-core, for one), I don't know if they are aware of Emscripten-specific tools for this.
Other ways to reduce binary size at build time (install tags, better support build backend tooling, etc.) are best covered in pyodide-build, not here – we are concerned about what happens after build time.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository files or tests are named. Start with the linked Emscripten optimization guidance and inspect the post-build object files in wheels; compare wasm-opt, wasm-dce, and wasm-strip for measurable size reduction, keeping build-time concerns in pyodide-build out of scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, wasm
- Domain
- build-system, performance, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100