3 ms·
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, b
by Shish2k 4y ago
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)...
- jamincan 4y agoYou can check out a number of strategies for reducing rust binary size here: https://github.com/johnthagen/min-sized-rust 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<T: AsRef<str>>(s: T) -> String { bar(s.as_ref()) } fn bar(s: &str) -> String { // A whole bunch of other stuff s.to_string() }