WebAssembly.instantiate

Hi

Elements is using WebAssembly.instantiate WebAssembly.instantiate() - JavaScript | MDN
I noticed on the doc site :

Warning: This method is not the most efficient way of fetching and instantiating wasm modules. If at all possible, you should use the newer WebAssembly.instantiateStreaming() method instead, which fetches, compiles, and instantiates a module all in one step, directly from the raw bytecode, so doesn’t require conversion to an ArrayBuffer.

Is it possible to update generated RemObjectsElements.js and fetchAndInstantiate() function to use the recommended method? This could improve the loading of our library that is ~50-100MB file.

Artur

1 Like

Logged as bugs://E25299.

@arturredzko My colleague @Diego_Navarro took a look at this and it turns out, we need the ArrayBuffer for debugging to work at all. So this doesn’t add any value for us. We’re going to look at an option to skip this, but for debug at least, we’ll need this.

no problem, maybe only use a new method for release build? I didn’t make speed tests though to be sure that recommended method is faster.

1 Like

If actually is faster, that’d be a good idea, yeah.