3 ms·
Looks like the actual artifacts are a 6kB html (with embedded JS) and a 52kB .wasm file. https://github.com/aochagavia/rocket_wasm/tree/master/html https://git
by haberman 9y ago
Looks like the actual artifacts are a 6kB html (with embedded JS) and a 52kB .wasm file.
https://github.com/aochagavia/rocket_wasm/tree/master/html https://github.com/aochagavia/rocket_wasm/tree/master/html
It's very nice to see that this "scales down", so-to-speak. It can be really disheartening to see small programs compile into hundreds-of-kB binary images. It's great to see that Rust+WASM can be so lean!
- steveklabnik 9y agoa "add one to a number and return it" compiled this way results in a ~100 byte binary. It's about twice the size of writing it by hand, but those gains get lost as soon as you start doing real things, so it's not a big deal. One big jump in binary size starts when you use the allocator, as then it needs to include the allocator's code.
- haberman 9y agoIt would be nice if there was a modern malloc implementation (with good multi-threaded performance) that optimized for size.
- steveklabnik 9y agoWe use a Rust port of dlmalloc with this toolchain. Multithreading doesn't matter to wasm yet, incidentally; it's still single threaded.
- wofo 9y agoNote that I am using the allocator in Rocket, so I would estimate the size to be something around 40kB