<@UAZ8LS9KJ> <@U0BMF6PDJ> wasm-merge is back! I th...
# webassembly
s
@Svyatoslav Kuzmich [JB] @bashor wasm-merge is back! I think I will do another try on my Kotlin/Wasm interrop with Rust sample app with it. https://twitter.com/kripken/status/1658534363494248449
👍 4
b
👍 Also, it could be useful to cooptimize a compose app and skiko binaries.
s
Yeah, the doc mentions cross Wasm module DCE should work as expected.
a
For us newbies, can you tell us what wasm-merge is and any source you think is best for us to check it out?
b
wasm-merge combines wasm files together. For example, imagine you have a project that uses wasm files from multiple toolchains. Then it can be helpful to merge them all into a single wasm file before shipping, since in a single wasm file the calls between the modules become just normal calls inside a module, which allows them to be inlined, dead code eliminated, and so forth, potentially improving speed and size
https://github.com/WebAssembly/binaryen#wasm-merge
So it could be used to merge and optimze few wasm binaries together
a
woooow, this sounds so amazing.
o
Hm, this could simplify mine ffi-kotlin experiment Can we expect (soon or some day) some compiler argument like ‘include-wasm’? Similar to ‘include-library’ in K/N? :)
b
I’m not sure about compiler, but it could integrated to gradle tooling
Feel free to describe your case at kotl.in/issue
o
I will create an issue later today But in few words describe the idea If we are developing some library and want to depends on some f.e. native (C, Rust, etc) library, in case it’s not available in future in wasi component repository f.e. like now we have skia (canvaskit) or openssl’s libcrypto (with which Im experimenting) which ideally can be just embedded and distributed with current k/wasm klib or as separate artifact, which will be then automatically merged into final binary (similar to how static linking in K/N works).