bytecodealliance / bytecodealliance/wasmtime
Eventual API support for instantiateStreaming or compileStreaming?
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 135
Description
I'm currently writing infrastructure for a toy language where the design was to stream source from `disk` -> `tokenizer` -> `parser` -> `compiler` -> `wasmtime`, avoiding the need to hold entire various forms of the program in memory at any point. Unfortunately, I don't see API's in wasmtime compatible with this design (to be fair, this seems to be common among non-browser wasm runtimes).
I may have missed something, but it appears wasmtime expects all wasm source to be collected into memory before submission to the Module compiler. For example `Module::from_file()` seems to just spool the entire file into memory, and then give it to `Module::new()`. What I was hoping to find was something like [instantiateStreaming](https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/instantiateStreaming) or [compileStreaming](https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/compileStreaming) from the JS WebAssembly API, which takes a stream of wasm bytecode instead.
Is this kind of API something wasmtime might implement in the future, or is there a reason/rationale for not wanting to support it?
Thanks!
Contributor guide
Research direction
Start with the mentioned Module::from_file() and Module::new() entry points, then compare their behavior with the WebAssembly instantiateStreaming and compileStreaming APIs linked in the issue. Determine whether a streaming API is feasible and document the rationale or define the scope needed for future support; completion would require a maintainer decision on the proposed direction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- backend-api-design, compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100