I met a person at Wasm research day in Munich (I never registered the name, sorry) who told me that it should be possible to reduce the size of the CLI executable significantly. When compiling it straight out of the box (repo) with --release
the executable is about 50 MB. With the following options in Cargo.toml
:
[profile.release]
strip = true # Automatically strip symbols from the binary.
opt-level = "z" # Optimize for size.
lto = true
I can get it down to 19 MB.
The question is: is it possible to reduce it further without hurting performance? I'd like to avoid dynamically linked libraries.
I think this is what you're looking for: https://github.com/bytecodealliance/wasmtime/pull/7282 There have also been some follow-up PRs, but I think everything else should be discoverable from this.
Documentation for producing a minimal build is now here and example release artifacts are here as wasmtime-min
executables inside of each CLI tarball. Currently this is ~2M, and depending on your use case that can be smaller too even.
If you've got size concerns still please let us know as it's something we'd like to be aware of!
what is this evil?
@Alex Crichton if you can get it down to 1.44MB, I will celebrate by purchasing some retro floppies and a floppy drive and creating the first ever Wasmtime Installation Disk
why stop there? I say 720kb or bust!
No one should ever need more than 720kb... wait.
This is just a curiosity for me so no pressure to do anything about it but I don't see artifacts at the link; were they replaced by CI?
I found them inside the .xz files -- two different executables
Yeah the new "min" artifacts are in the normal tarballs as the wasmtime-min
executable or the libwasmtime-min.so
dynamic library (or libwasmtime-min.a
)
squillace@idiopath:~$ ./wasmtime-min
error: one or more required arguments were not provided
heh part of being "min" is compiling out all the help text :)
args the same?
can I use wasmtime as a guide to wasmtime-min?
yes, or at least that's the intention!
np!!!
you can only feed in *.cwasm
into wasmtime-min
, but you can create the *.cwasm
with wasmtime
right
For your 720K floppy: wasmtime-min.xz 610K
:smile:
(I assume you already have liblzma on your IBM PC Convertible)
as one does
Mats Brorsson has marked this topic as resolved.
Last updated: Dec 23 2024 at 14:03 UTC