#WASM file size in bevy examples

20 messages · Page 1 of 1 (latest)

verbal bronze
#

I tried to get the WASM file size down to 5MB like below example but I cannot get it below 10 MB
https://bevyengine.org/examples-webgpu/3d-rendering/3d-shapes/

I used trunk command below

trunk serve --release --example 3d_shapes

What am I doing wrong?

dull ledge
#

I don't think you are doing anything wrong. I say this because there's a crate called bevy_leptos which felt promising and then you realize, well, the whole app is now 50 mb (leptos is a web framework for rust)

#

however...I do wonder how that one guy got bevy to run on a gameboy...if I find something I'll let you know

#

oh also, could you share your release profile in your Cargo.toml?

#

you can do something like

[profile.release]
opt-level = "z"

z optimizes for size
(there are some other options for this too)

verbal bronze
#

I tried every trick mentioned by ChatGPT but I can never get the wasm down to 5MB.

dull ledge
#

yeah ig that's how it be

#

would be good to investigate though...all that for some 2d shapes

elfin meadow
#

Be sure to note if you're measuring transfered vs actual size. In the above screenshot the wasm blob is 24mb, but only needed to transfer 7mb because of file compression

elfin abyss
#

I went through this recently in #web and what caused the biggest size saving was turning off unneeded features. I think it saved like 5-10 MB off of the size of the wasm blob, it used be 15-20 MB, but I eventually got it down to 11.5 MB, and serving with brotli compression made the transferred data be 2.5 MB (~3.5 MB with gzip compression)

verbal bronze
verbal bronze
#

I got it down to 14 MB (which is 4.3 MB zipped). Now I'm able to understand how some examples in Bevy show 5 MB download (its zipped size) 😁

dull ledge
#

Fire. I’m also going to give it a shot

#

I’ll lyk if I can beat it

#

What compression did you use? Brotli?

elfin abyss
elfin abyss
verbal bronze