For what it's worth I don't think 3MB is extremely large anymore, as several popular websites already weight in 2-3 MB for a full page loads.
Examples:
* www.youtube.com = 3.3 MB
* www.tiktok.com = 3.3 MB
* www.instagram.com = 2.1 MB
(according to https://www.supermonitoring.com/p/page-speed)That said, I would love to shave off more size off my wasm binaries :-)
Some notes I found just now seems to be in line with my results, though: https://github.com/bevyengine/bevy/issues/3978#issuecomment-...
[profile.release]
lto = "fat"
codegen-units = 1
opt-level = 3
debug = false
panic = "abort"
strip = "debuginfo"
[profile.wasm-release]
inherits = "release"
opt-level = "z"[1]: https://kobzol.github.io/rust/cargo/2024/01/23/making-rust-b...
I agree that 8MB seems high. I can generate a 6MB binary using `--debug` with `wasm-pack` so definitely for a more complex thing I could see 8MB. I think `--release`, `codegen-units = 1`, `opt-level = 3/z` are the three biggest things that affect binary size for me.
I don't think 8MB is that big a deal for a web game though. Like how large are the images? If you're going to dynamically load in like 50+ MB of assets then having an initial game of 8 MB is the small pole in the tent. I have my stuff setup as a PWA so once everything has been downloaded it takes 0 MB on the wire to open a second time; you could set-up the game as 2 binaries; one super-small one that just basically handles an opening cinematic and a larger one that can actually play the game which is downloaded while the cinematic plays (or is cached in future opens).