Yeah, that’s what I’m working on at the moment but still fighting with the certification… getting close though I think.
TL;DR the runtime/stdlib size for Rust and Motoko seem to be:
Rust 400KB
Motoko 55KB
Preliminary results, the dfx
Motoko demo that just has one function that returns “Hello, World” produces a WASM file with moc --release main.mo
that is about 55K after minify with wasm-opt and gzip:
107,612 main.min.wasm
55,772 main.min.wasm.gz
110 main.mo
206,158 main.wasm
My WAT generated wasm file that includes Base64 encode/decode, LEB encode/decode, and the HttpRequest and Certificate handling is about 1.1K after minify and gzip, 400 bytes of which is the embedded index.html, root hash, and response headers:
1,674 compiled.min.wasm
1,114 compiled.min.wasm.gz
2,817 compiled.wasm
28,348 compiled.wat
The Rust demo which is also just a single hello function, produces are 400KB wasm file after minify and gzip with cargo build --target wasm32-unknown-unknown --release
:
1,558,488 icpdemo2_backend.min.wasm
409,131 icpdemo2_backend.min.wasm.gz
1,934,744 icpdemo2_backend.wasm
There may be ways to shrink those further with Motoko and Rust. I’m no expert there.
I think all of the gzipped assets for my demo frontend are about 16KB, so the size quickly becomes dominated by the frontend assets, given they are text based source code.