Re:Rocket – A Rust game running on WASM
by steveklabnik on Monday December 04, 2017 @12:52PM
(#15845862)
a "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.
Re:Rocket – A Rust game running on WASM
by haberman on Monday December 04, 2017 @02:25PM
(#15846648)
It would be nice if there was a modern malloc implementation (with good multi-threaded performance) that optimized for size.
Re:Rocket – A Rust game running on WASM
by steveklabnik on Monday December 04, 2017 @02:50PM
(#15846830)
We use a Rust port of dlmalloc with this toolchain.
Multithreading doesn't matter to wasm yet, incidentally; it's still single threaded.
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!