fengqi2019 opened issue #3596:
hello, i just learn wasi. i compile the helloworld's code to wasi in release, and the wasi's size is 1.78M(i think it is too big.), is there any way to reduce wasi's size?
the helloworld code:fn main() { println!("Hello, world!"); }
bjorn3 commented on issue #3596:
Did you enable LTO? That helps a lot with removing dead code.
fengqi2019 commented on issue #3596:
it is useful, now it's size is 250k. thanks a lot!
fengqi2019 closed issue #3596:
hello, i just learn wasi. i compile the helloworld's code to wasi in release, and the wasi's size is 1.78M(i think it is too big.), is there any way to reduce wasi's size?
the helloworld code:fn main() { println!("Hello, world!"); }
tschneidereit commented on issue #3596:
Most of that is probably still debug symbols, and running wasm-strip on the result will further reduce the size substantially. Running it through wasm-opt with
-O3
or-Os
makes it even smaller.The smallest I can get this is 61kb, with these commands:
rustc --target wasm32-wasi main.rs -o main.wasm wasm-opt -Os --strip -o main.wasm main.wasm
Last updated: Dec 23 2024 at 13:07 UTC