DEV Community

Discussion on: Web Assembly should be a default binary target

Collapse
spock123 profile image
Lars Rye Jeppesen

Great article.

A big issue is the large initialization time as the browser still needs to compile/interpret the wasm payloads.

Collapse
nxtexe profile image
𝓃𝓍𝓉𝑒.𝓅𝓎 🇯🇲

This may be less of a problem once interface types are fully integrated. Some including myself hope to see a script tag feature added where the type can be "application/wasm" and be fed a wasm binary directly without JavaScript setting up an environment.

Collapse
mitschabaude profile image
Gregor Mitscha-Baude • Edited on

That would definitely be nice! But I wouldn't expect that it would make a noticeable performance difference to what you can do today: inline a couple of lines of JS that instantiate the Wasm

Collapse
taybenlor profile image
Ben Taylor Author

I agree this is an important consideration but the overheads here are getting smaller and smaller. The Python binary (a whole language runtime!) on WAPM is sitting at 5mb. Right now the median desktop page weight on HTTP archive is about 2mb. So not that substantial an increase, plus it'll get cached.

The classic way to instantiate WASM was to grab all the bytes, then instantiate it over multiple steps. This can now be done in streaming mode, meaning it'll happen as the binary downloads. This is much simpler and faster!

When you compare it to something like video playback it's not really that bad at all. Just feels bad because this isn't how things have been done historically.