3 ms·
If available it's better to use instantiateStreaming [0] for faster compilation, e.g. this: fetch('../out/main.wasm').then(response => response.array
by Promarged 8y ago
If available it's better to use instantiateStreaming [0] for faster compilation, e.g. this:
fetch('../out/main.wasm').then(response =>
response.arrayBuffer()
).then(bytes => WebAssembly.instantiate(bytes))
could be expressed as this:
fetch('../out/main.wasm').then(response =>
WebAssembly.instantiateStreaming(response))
[0]: https://hacks.mozilla.org/2018/01/making-webassembly-even-faster-firefoxs-new-streaming-and-tiering-compiler/ https://hacks.mozilla.org/2018/01/making-webassembly-even-fa...
- dmix 8y agoWouldn't that still require `response.arrayBuffer()`? For ex (line 2): fetch('../out/main.wasm').then(response => WebAssembly.instantiateStreaming(response.arrayBuffer())) Otherwise it could just be: fetch('../out/main.wasm').then(WebAssembly.instantiateStreaming)
- deleted 8y ago[deleted]
- deleted 8y ago[deleted]