A while back when I first dipped my toes into wasm, I found some tips on how to reduce the size of the wasm blobs. It involved running wasm-strip
, wasm-snip
and wasm-opt
. I wrote a script that would automatically run all of these, and it not only worked, it worked surprisingly well -- the blob was pretty drastically reduced in size.
I recently started experimenting with wasm again, and while I have upgraded Rust toolchains and wasm-snip
(because I upgrade all my cargo-built packages regularly), the other wasm tools remained the same.
When I ran my old script wasm-opt
and wasm-strip
complained about errors in the wasm blob. I figured it was due to upgraded Rust toolchains, and old tools, so I upgraded wabt and binaryen, but not only did it still print errors, I got other (and more) errors. There's clearly some incompatibility between tools and the wasm blob Rust is generating.
I did read the proverbial warning label on the box; the page that recommended wasm-opt
et al was very explicit about it being experimental tools and one shouldn't expect them to work at all or (even worse) not to introduce subtle bugs.
Ignoring the "use at your own risk" warning labels for a moment .. Is there some way to determine what versions of Rust and the wasm tools are compatible? Like some revision header field in the blob that can be compared to some constant in the tools' headers? Or is this just a case of moving targets [and it'll stabilize with time]?