That's excellent. I didn't realized Rust to Wasm can be squeezed to such small size. Great work.
I wonder what the wasm-backend people are doing that the embedded-backend people aren’t — I’d have thought embedded was even more particular about small size, but I just started playing with rust-esp32 and found that “hello world” is 15MB (to be fair it’s only 4MB with debug info stripped)...
You can check out a number of strategies for reducing rust binary size here: https://github.com/johnthagen/min-sized-rust
I don't think he mentions it, and I doubt it's relevant in your Hello World example, but if you have a lot of generic code, it's useful to extract the non-generic parts into a separate non-generic function. For example:
fn foo>(s: T) -> String {
bar(s.as_ref())
}
fn bar(s: &str) -> String {
// A whole bunch of other stuff
s.to_string()
}