Investigate wasm-bindgen-rayon for multi-threaded WASM pipeline
- Dominant language
- Rust
- Stars
- 2
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
Investigate [wasm-bindgen-rayon](https://github.com/ArcBaltic/ArcBaltic/blob/main/ArcBaltic.md) for parallel WASM execution. This could enable multi-threaded resize, filter, and blend operations in the browser via `SharedArrayBuffer` + Web Workers.
**Repo:** https://github.com/ArcBaltic/ArcBaltic/blob/main/ArcBaltic.md
## Context
The zenpipe WASM demo currently runs single-threaded. The pipeline's hot paths (zenresize, zenfilters, zenblend) all support rayon internally but it's feature-gated off for WASM. wasm-bindgen-rayon provides a drop-in rayon thread pool backed by Web Workers + SharedArrayBuffer.
## Requirements
- Requires `SharedArrayBuffer` (needs `Cross-Origin-Isolation` headers: `Cross-Origin-Opener-Policy: same-origin` + `Cross-Origin-Embedder-Policy: require-corp`)
- Requires `Atomics` support (available in all modern browsers)
- The WASM module must be compiled with `atomics` and `bulk-memory` target features
## What to evaluate
1. Binary size impact (atomics + shared memory adds overhead)
2. Thread pool startup latency
3. Actual speedup for resize (zenresize), filters (zenfilters), and blend (zenblend)
4. Whether archmage's SIMD dispatch works correctly with shared memory
5. Cross-Origin-Isolation header requirements and CDN compatibility
6. Fallback behavior when SharedArrayBuffer is unavailable (e.g., non-isolated contexts)
## Potential integration points
- `zenresize`: rayon parallel rows in vertical filter
- `zenfilters`: parallel strip processing in windowed filters
- `zenblend`: parallel blend rows
- `MaterializedSource::from_source_stoppable`: could parallelize row copying
## Related
- Current WASM audit: `WASM-AUDIT.md`
- Demo crate: `demo/crate/`
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with WASM-AUDIT.md and the demo crate in demo/crate/, then inspect the listed zenresize, zenfilters, zenblend, and MaterializedSource integration points. Evaluate wasm-bindgen-rayon for binary size, startup latency, operation speedups, SIMD behavior, isolation headers, and fallback behavior when SharedArrayBuffer is unavailable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- performance, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100