Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the binary size #1464

Closed
kvark opened this issue Jan 5, 2021 · 6 comments
Closed

Reduce the binary size #1464

kvark opened this issue Jan 5, 2021 · 6 comments
Labels
area: infrastructure Testing, building, coordinating issues help required We need community help to make this happen. type: enhancement New feature or request

Comments

@kvark
Copy link
Member

kvark commented Jan 5, 2021

See https://twitter.com/batmansmk/status/1346479574465433613
A simple app got compiled to an 1.3Mb executable. I'm sure we can do better!

@kvark kvark pinned this issue Jan 5, 2021
@cwfitzgerald
Copy link
Member

This is espcially important on wasm/webgl, where the blob has to be shipped over the wire. Currently our examples, built in release, sit at about 5-6MB uncompressed.

@kvark kvark unpinned this issue Jan 26, 2021
@kvark kvark transferred this issue from gfx-rs/wgpu-rs Jun 3, 2021
@kvark kvark added the help required We need community help to make this happen. label Jun 3, 2021
@maxammann
Copy link
Contributor

maxammann commented Dec 10, 2021

I can confirm this for WebGL builds. Not for builds which use WebGPU. I'm currently at 1.6Mb uncompressed (Gziped its 571k.). The reason for this could also be that winit, web-sys or js-sys introduces this issue. I haven't debugged the root cause so far.

Steps I've completed so far:

  • Build in release profile
  • Enable optimizations for release profile:
    [profile.release]
    lto = true
    codegen-units = 1
    opt-level = 's'
  • Run wasm-opt
  • Disabling unused features like "x11", "wayland" for winit

Further ideas: https://rustwasm.github.io/book/reference/code-size.html

I think that the uncompressed size should be below 1Mb, else the compilation on the client side could be a real bottleneck (CPU fans spin up etc.). In comparison for WebGPU my build size is already 708k without compression (compressed its down to 222k).

@maxammann
Copy link
Contributor

@kvark did you use the WebGL backend or WebGPU?

@kvark
Copy link
Member Author

kvark commented Dec 10, 2021

I didn't measure either, just linked to a tweet.

@maxammann
Copy link
Contributor

I didn't measure either, just linked to a tweet.

I might do some better reproducible measurements soon :) Something that would be awesome would be a CI step which validates that WASM builds are not exploding in size. If the size of the wasm file doubles for example with the introduction of a commit then there is a serious problem.

@cwfitzgerald cwfitzgerald added type: enhancement New feature or request area: infrastructure Testing, building, coordinating issues labels Jun 5, 2022
@cwfitzgerald
Copy link
Member

This has no particular actionability, so I'm going to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: infrastructure Testing, building, coordinating issues help required We need community help to make this happen. type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants