Skip to content

Instantly share code, notes, and snippets.

@DrSensor
Created June 8, 2018 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DrSensor/5cdbbc02fa7d57015913df28b3f2021a to your computer and use it in GitHub Desktop.
Save DrSensor/5cdbbc02fa7d57015913df28b3f2021a to your computer and use it in GitHub Desktop.
binaryen-loader passes
{
loader: 'binaryen-loader',
options: {
optimization: {
level: 2,
shrinkLevel: 2
},
transformation: {
// https://github.com/WebAssembly/binaryen/blob/master/src/passes/pass.cpp#L67-L126
passes: [
// 'coalesce-locals', // don't use if coalesce-locals-learning is set
'coalesce-locals-learning',
// 'code-pushing',
// 'const-hoisting',
'code-folding',
'dce',
'duplicate-function-elimination',
// 'extract-function', // cause error
// 'flatten', // increase size
// 'fpcast-emu',
// 'func-metrics', // debug
// 'inlining', // don't use if inlining-optimizing is set
'inlining-optimizing',
// 'legalize-js-interface',
// 'local-cse',
// 'log-execution', // debug
// 'i64-to-i32-lowering',
// 'instrument-locals', // removing to much (TODO: need to be inspected)
// 'instrument-memory', // increase size
// 'memory-packing',
// 'merge-blocks', // increase size
// 'merge-locals', // increase size
// 'metrics', // debug
// 'nm', // debug
// 'optimize-instructions',
// 'pick-load-signs',
'post-emscripten',
// 'precompute',
// 'precompute-propagate',
//#region debug
// 'print',
// 'print-minified',
// 'print-full',
// 'print-call-graph',
//#endregion
// 'relooper-jump-threading',
// 'remove-non-js-ops', // not found
'remove-imports',
'remove-memory',
'remove-unused-brs',
'remove-unused-module-elements',
'remove-unused-nonfunction-module-elements',
'remove-unused-names',
// 'reorder-functions',
// 'reorder-locals',
// 'rereloop', // decrease size but cause unreachable (TODO: need to be inspected)
// 'rse',
// 'safe-heap', // increase size
// 'simplify-locals',
// 'simplify-locals-nonesting',
// 'simplify-locals-notee',
// 'simplify-locals-nostructure',
// 'simplify-locals-notee-nostructure',
// 'spill-pointers', // failed to find the stack pointer
// 'ssa',
// 'trap-mode-clamp',
// 'trap-mode-js',
// 'untee',
'vacuum'
]
},
debug: false
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment