6 ms·
That's excellent. I didn't realized Rust to Wasm can be squeezed to such small size. Great work.
by ww520 4y ago
That's excellent. I didn't realized Rust to Wasm can be squeezed to such small size. Great work.
- cryptoegorophy 4y agoNot sure how old are you but if you were there 20-23 years ago you could’ve stumbled upon these .exe files that were 5-64kb in size(not megabyte!) with cool looking videos and music. Back then this was a miracle, it still is to me.
- cryptoegorophy 4y agoForgot a link https://youtu.be/ycmgjZLU0xQ https://youtu.be/ycmgjZLU0xQ
- nekitamo 4y agoYou might be interested in this website which archives those old intros, and showcases new ones: https://www.pouet.net/ https://www.pouet.net/
- laurentlb 4y agoWe are still making these 4kB - 64kB demos. My group: https://www.ctrl-alt-test.fr/productions/ https://www.ctrl-alt-test.fr/productions/ The Pouet search contains a good list of modern 64kB: https://www.pouet.net/toplist.php?type=64k&platform=68&limit=40&days=2500 https://www.pouet.net/toplist.php?type=64k&platform=68&limit...
- pdpi 4y agoYou might want to look into the nonsense the demoscene folks get up to, then. .kkrieger is a pretty serious FPS in 96kB, 8088MPH gets 1k colours out of an 8088 with CGA graphics. Things like that
- royjacobs 4y agoI'm actually in the process of writing a demoscene 64k in Rust+WASM, that will be contained in a single index.html. Actually not sure if I'll get around to finishing it, but currently a WebGPU-based renderer + scene graph + softsynth fits in about 30k compressed. That's unfortunately a bit big, but we'll see. If I don't get around to finishing it I'll probably open source the code anyway, just as a fun starting point for others maybe.
- ww520 4y agoWould be good to see the process and sound. Do you think it’s the WebGPU, scene graph, the sound, or the Rust infrastructure that consumes the most space?
- royjacobs 4y agoA little bit of everything, but the WebGPU stuff requires a full interop layer to translate WebGPU calls on the Rust side into calls on the JS side (a poor man's wasm-bindgen basically). Additionally, there's just a lot of code being generated for common containers. It would probably be simpler and smaller to create unsafe containers that just shift pointers to boxed structs around or something, but I haven't gotten around to that yet.
- Shish2k 4y agoI 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() }