DEV Community

Reduce your WebAssembly binaries 72% - from 56KB to 26KB to 16KB 🎉✨🦄

Sendil Kumar on July 07, 2019

Every byte counts - Optimize them Budgets are critical to the performance. It is very important to send down as less as possible. Check...
Collapse
 
johnfound profile image
johnfound

I wonder, whether someone is trying to program in WebAssembly directly and what will be the size of the programs in this case.

Because, if we are talking about the CPU assembly language programming, it usually gives huge amount of size and speed improvement.

The program mentioned in the article is relatively simple. If imagine we want to implement it as a desktop application in Linux or Windows, my estimation is that it easily can be fit in less than 1KB and the main limitation factor will be the executable file format, not the code itself.

Collapse
 
gklijs profile image
Gerard Klijs

Any idea the sam program written in Rust would be similar in size? From the tutorial they used Binaryen and some couple of other tricks in the documentation to trim the size.

Collapse
 
sendilkumarn profile image
Sendil Kumar

Yeah. It is possible but I doubt we can achieve this much. I haven't played with it recently. Let me check what we can achieve there.

Collapse
 
elliot profile image
Elliot • Edited

Loving seeing the WebAssembly content on here.

I haven't used WebAssembly much, but this article gets me really excited about just how much performance you can squeeze out of it!

Collapse
 
sendilkumarn profile image
Sendil Kumar

Go for it... Let me know if you need help with anything :)

Collapse
 
stewartjarod profile image
Jarod Stewart

KB vs Kb

Collapse
 
sendilkumarn profile image
Sendil Kumar

typo 🙂

Collapse
 
sendilkumarn profile image
Sendil Kumar

Yeah it is awesome.

Collapse
 
matusbielik profile image
Matúš Bielik

So what's the main selling point of wasm? If compared to ja version,

Is the file of the compiled wasm smaller than a minified pure js script?

Is the execution speed noticeably faster?