One compiled WebAssembly.Module, shared by every data worker.
Each worker used to call initWasm() independently, which fetches and
COMPILES its own copy of the same binary. Measured on a hosted demo with 15
workers: they became ready on a ~160 ms cadence, 2.2 s from the first to the
last, and the first LOD's decode sat waiting for all of them.
A WebAssembly.Module is structured-cloneable, so the main thread can
compile once and postMessage the result into each worker, which then only
has to instantiate. See instantiateWasmShim in ./index.ts for the
receiving half.
DEGRADES, ALWAYS. Every failure path resolves null rather than rejecting,
and null simply means each worker takes today's self-init path. That is
deliberate: this is an optimization, and a broken optimization must not be
able to take the viewer down with it.
One compiled
WebAssembly.Module, shared by every data worker.Each worker used to call
initWasm()independently, which fetches and COMPILES its own copy of the same binary. Measured on a hosted demo with 15 workers: they became ready on a ~160 ms cadence, 2.2 s from the first to the last, and the first LOD's decode sat waiting for all of them.A
WebAssembly.Moduleis structured-cloneable, so the main thread can compile once and postMessage the result into each worker, which then only has to instantiate. SeeinstantiateWasmShimin./index.tsfor the receiving half.DEGRADES, ALWAYS. Every failure path resolves
nullrather than rejecting, andnullsimply means each worker takes today's self-init path. That is deliberate: this is an optimization, and a broken optimization must not be able to take the viewer down with it.