Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm-opt? #1

Open
sbc100 opened this issue Oct 13, 2020 · 1 comment
Open

wasm-opt? #1

sbc100 opened this issue Oct 13, 2020 · 1 comment

Comments

@sbc100
Copy link

sbc100 commented Oct 13, 2020

This is very cool!

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

@wingo
Copy link
Owner

wingo commented Oct 19, 2020

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants