It works, but wasm isn't free. I noticed that zed has some funny-looking code to carefully reuse TS objects, so I did some benchmarks to make sure that this API design doesn't put us into a corner. Benchmarks were run on my Macbook only. It turns out that what Zed is doing saves ~20% of the wasm language load time (25ms->20ms), entirely because instantiating a TSWasmStore takes ~5ms.
Loading a language
| grammar | native ms | wasm ms | native RAM MB | wasm RAM MB |
|---|---|---|---|---|
| javascript | 0.1 | 24.0 | 0.2 | 0.9 |
| rust | 0.1 | 20.7 | 0.0 | 2.2 |
| python | 0.1 | 20.6 | 0.0 | 1.0 |
| typescript | 0.1 | 23.4 | 0.0 | 2.0 |