Skip to content

WASM file size? #1

@ivnsch

Description

@ivnsch

Thanks for creating this template!

Creating the release build, as specified in the readme, shows this warning:

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
fonts/fa-solid-900.svg (775 KiB)
images/[email protected] (575 KiB)
images/[email protected] (354 KiB)
images/pfbg_2000.jpg (270 KiB)
main.js (1.17 MiB)
main.wasm (2.04 MiB)

Notably: main.wasm (2.04 MiB)

I checked the Yew optimizations guide (https://yew.rs/advanced-topics/optimizations#cargotoml) and was able to reduce it to 1.17 MB by adding this to the cargo.toml:

[profile.release]
# less code to include into binary
panic = 'abort' 
# optimization over all codebase ( better optimization, slower build )
codegen-units = 1
# optimization for size ( more aggressive )
opt-level = 'z' 
# optimization for size 
# opt-level = 's' 
# link time optimization using using whole-program analysis
lto = true

Still, 1.17 MB seems large (without all the assets). Would it be feasible to work on optimizing this template (including e.g. inspecting the binary with Twiggy)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions