DEV Community

Discussion on: How to only Rust for web front_end

Collapse
 
arnthelongbeard profile image
arn-the-long-beard • Edited

Hello ! Thank you for your comments :)

Regarding the size, we have a big difference there.

The seeded version of the game is much bigger in Wasm.

With cargo make build_release

wc -c pkg/package_bg.wasm -> 368597 pkg/package_bg.wasm

gzip -9 < pkg/package_bg.wasm | wc -c -> 142825

I did not succeed to do the same command on my original Js+Wasm project, but on a clone of the available source with same options in Cargo.toml ( so there not the exercises like Random Universe and others)

wasm-pack build --release

wc -c pkg/wasm_game_of_life_bg.wasm -> 40271 pkg/wasm_game_of_life_bg.wasm
My original was around 47K from what I remember.

gzip -9 < pkg/wasm_game_of_life_bg.wasm | wc -c
-> 17498

Can be interesting to compare the total loaded in the web browser between the 2 projects.

Regarding the performance, a nice way to compare could be to increase a lot the size of the grid, but for now I do not have any metrics. I am gonna investigate to have an idea :)

Collapse
 
roka profile image
Robert Katzki

Thanks! A comparison to the same in just JS would be interesting to see whether it’s worth the effort to use WASM.

Thread Thread
 
arnthelongbeard profile image
arn-the-long-beard

When I push a lot the size of the grid, I get better performance on wasm+js than Seed, but that is mainly because I did not optimize the Seed code.

But the code for me is still much easier to work with, update & maintain in pure Rust than js :)