2018-10-03 17:41:02 +01:00
|
|
|
# wasm-opt
|
|
|
|
|
|
|
|
> Optimize WebAssembly binary files.
|
2021-11-06 20:52:43 +00:00
|
|
|
> More information: <https://github.com/webassembly/binaryen>.
|
2018-10-03 17:41:02 +01:00
|
|
|
|
|
|
|
- Apply default optimizations and write to a given file:
|
|
|
|
|
|
|
|
`wasm-opt -O {{input.wasm}} -o {{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.wasm}}`
|
|
|
|
|
|
|
|
- Optimize a file for size:
|
|
|
|
|
|
|
|
`wasm-opt -Oz {{input.wasm}} -o {{output.wasm}}`
|
|
|
|
|
|
|
|
- Print the textual representation of the binary to console:
|
|
|
|
|
|
|
|
`wasm-opt {{input.wasm}} --print`
|