walloc icon indicating copy to clipboard operation
walloc copied to clipboard

wasm-opt?

Open sbc100 opened this issue 5 years ago • 1 comments

This is very cool!

I'm curious, does it get any smaller with wasm-opt -O2 applied?

sbc100 avatar Oct 13 '20 22:10 sbc100

Hey @sbc100, tx for kind words :)

Good question! Here's some tests. test.wasm is the "stock" walloc as built by "make test" with clang from mid-september, built with -Oz. The different optimization levels below are the levels passed to walloc-opt.

-rw-rw-r-- 1 wingo wingo  1810 Oct 19 10:10 test-O0.wasm
-rw-rw-r-- 1 wingo wingo  1681 Oct 19 10:10 test-O1.wasm
-rw-rw-r-- 1 wingo wingo  1660 Oct 19 10:10 test-O2.wasm
-rw-rw-r-- 1 wingo wingo  1648 Oct 19 10:10 test-O3.wasm
-rw-rw-r-- 1 wingo wingo  1662 Oct 19 10:10 test-O4.wasm
-rw-rw-r-- 1 wingo wingo  1647 Oct 19 10:10 test-Os.wasm
-rw-rw-r-- 1 wingo wingo  1647 Oct 19 10:10 test-O.wasm
-rw-rw-r-- 1 wingo wingo  1647 Oct 19 10:10 test-Oz.wasm
-rwxrwxr-x 1 wingo wingo  2023 Oct 13 14:36 test.wasm

So wasm-opt makes a binary that is 81% the size of the original. Not bad!

wingo avatar Oct 19 '20 08:10 wingo