WebAssembly / WebAssembly/wasi-libc
memcpy is much larger than Emscripten variant
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1k
- Forks
- 251
- Avg merge
- 7h 15m
- Merged PRs (30d)
- 3
Description
I'm in the process of [experimentally] migrating some code that today gets compiled via Emscripten to wasi-sdk.
Doing size comparisons, for one of the reactors the Emscripten-compiled binary is significantly smaller:
decoder_emcc.wasm 6872
decoder_wasi.wasm 8365
Looking at the delta (1493 bytes), it looks like a lot of the delta comes down to the differences in sizes between memcpy (that this code needs, and using bulk-memory extension of Wasm isn't an option):
wasi memcpy: 1448
emcc memcpy: 518
delta 930 bytes
This is the change that optimized memcpy version in Emscripten: https://github.com/emscripten-core/emscripten/pull/7648
Would it be possible to implement something along these lines here?
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
Start at the existing wasi memcpy entry point and compare its generated output with the optimization described in Emscripten PR #7648. Reproduce the decoder_emcc.wasm and decoder_wasi.wasm size comparison, then measure memcpy and total binary sizes after the change; done means the optimization is implemented without relying on bulk-memory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, wasm
- Domain
- operating-systems, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100