leptos-rs / start-axum

Starter template for use with the Leptos web framework and Axum.
The Unlicense
141 stars 26 forks source link

`profile.release` is missing #17

Closed cedeber closed 9 months ago

cedeber commented 1 year ago

profile.wasm-release inherits from release but profile.release is not set.

Wouldn't be Cargo.toml look like this instead?

[profile.release]
lto = true        # Enable link-time optimization
codegen-units = 1 # Reduce number of codegen units to increase optimizations
panic = "abort"   # Abort on panic
strip = true      # Strip symbols from binary

# Defines a size-optimized profile for the WASM bundle in release mode
[profile.wasm-release]
inherits = "release"
opt-level = "z"      # Optimize for size

It allows to have start-axum from 9MB to 4.1MB on my M1. strip=true will be also very useful for linux users as the debug symbols are embedded in the binary, unlike on Windows or Mac. And it's also MB of data.

gbj commented 1 year ago

Personally, I think the default release profile is probably the best starting point, rather than baking any of those preferences into the template.

cedeber commented 1 year ago

Why just doing it for wasm then ?

gbj commented 1 year ago

Binary size is an extremely important performance issue for WebAssembly because it has to be shipped over the network to your users.