HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

wasm-opt — Optimize WebAssembly binary files. More information: <https://manned.org/wasm-opt>.

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandfileswebassemblyoptimizeclibinarymorewasm-opt

Problem

How to use the wasm-opt command: Optimize WebAssembly binary files. More information: <https://manned.org/wasm-opt>.

Solution

wasm-opt — Optimize WebAssembly binary files. More information: <https://manned.org/wasm-opt>.

Apply default optimizations and write to a given file:
wasm-opt -O {{input.wasm}} {{[-o|--output]}} {{output.wasm}}


Apply all optimizations and write to a given file (takes more time, but generates optimal code):
wasm-opt -O4 {{input.wasm}} {{[-o|--output]}} {{output.wasm}}


Optimize a file for size:
wasm-opt -Oz {{input.wasm}} {{[-o|--output]}} {{output.wasm}}


Print the textual representation of the binary to console:
wasm-opt {{input.wasm}} --print

Code Snippets

Apply default optimizations and write to a given file

wasm-opt -O {{input.wasm}} {{[-o|--output]}} {{output.wasm}}

Apply all optimizations and write to a given file (takes more time, but generates optimal code)

wasm-opt -O4 {{input.wasm}} {{[-o|--output]}} {{output.wasm}}

Optimize a file for size

wasm-opt -Oz {{input.wasm}} {{[-o|--output]}} {{output.wasm}}

Print the textual representation of the binary to console

wasm-opt {{input.wasm}} --print

Context

tldr-pages: common/wasm-opt

Revisions (0)

No revisions yet.