dfinity / ic-wasm

A collection of libraries and tools for transforming Wasm canisters running on the Internet Computer
Apache License 2.0
34 stars 5 forks source link

Aggressive inlining options for `wasm-opt` #42

Closed kentosugama closed 1 year ago

kentosugama commented 1 year ago

This PR is related to the new cost model.

@luc-blaeser found in some experiments that the new overhead pertaining to the cost of Call instructions can be mitigated down to ~4% with aggressive inlining options from wasm-opt. This has a large cost in terms of binary size (2.2x) but can serve as a temporary fix while we find better, Motoko specific inlining strategies.

The specific options are

-O4 -ifwl -aimfs 100

-ifwl stands for inline functions with loops -aimfs stands for always inline max function size

The arguments to the optimize command has been restructured so adding further options in the future is easy.