clockworklabs / clockworklabs/SpacetimeDB
Reduce WASM startup time / call-reducer time by memoizing and more direct calls
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 25.2k
- Forks
- 1.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 46
Description
Currently, when the WASM module crashes, we must first do an expensive __describe_module__ call, but we could instead store the extracted RawModuleDef in the host instead, so we only ever have to call __describe__module__ when the module is published.
One impediment to this is that in the Rust rt.rs bindings, __call_reducer relies on __describe_module__ having been called so that the list of reducers gets built. We should try to break this dependency, also because it could mean that we could dispatch directly to the reducer rather than having a dispatch table REDUCERS. Instead, we could host->module call __call_reducer_foobar__.
This could be done backwards compatibly by checking if there are any __call_reducer_*__.
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 in the Rust rt.rs bindings and trace how describe_module, _call_reducer, and the REDUCERS dispatch table interact. Investigate direct call_reducer* host-to-module calls and the backwards-compatible detection described in the issue. Done means crash handling no longer requires module description, description is limited to publication, and reducer dispatch remains compatible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- backend, databases, performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100