Replies: 2 comments
-
Confirmed.
I don't think this is a very helpful comparison; the two routers are quite different and have very different feature sets.
Not used even in the browser, to be more precise;
To me, this is kind of the heart of the question: the idea that routing is a "just," i.e., that "just introducing routing" is sort of a matter of running a To be clear, it would definitely be possible to build a router that focuses more on minimizing binary size, or a custom-built router that adds practically nothing. See the
I'm happy to go into the details more if you're really curious, but here are a few things you're adding to your app just by including routing at all
... etc.
Sure, probably! It's certainly possible to improve a lot with a router that's written differently or with different features. It's probably possible to improve at the margins in certain parts of the router code. I'll admit this is not a very high priority for me. In my experience using this and other Rust/WASM frameworks (including Sycamore) to build actual apps, I've found that the pursuit of shaving a few kb off WASM binary size at the framework level is not particularly useful. In reality, most of the weight of the WASM binary ends up being some combination of In this example the "no routing" version gzips to 26kb. The "with routing" version gzips to 76kb. The Leptos website gzips to 218kb (and is a 100 on Lighthouse mobile performance last time I checked); i.e., even for a one-page site our application code totally swamps the framework or the router in size, but still has fantastic loading performance. If one is in a situation in which the 50kb (gzipped) difference here really matters, WASM is probably the wrong choice. So I'd be very happy to see incremental improvements to the binary size! I just have a lot on my plate. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for the detailed information. I could even reduce the final binary size from 174KB to 143KB (uncompressed) just by adding this configuration in the right place ( [unstable]
build-std = ["std", "panic_abort", "core", "alloc"]
build-std-features = ["panic_immediate_abort"] |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When building a size optimized sample app, I could confirm that leptos_router is bloating WASM output size from 59KB to 174KB (nightly), A compatible sycamore app (80KB with routing) is more efficient in size compared to leptos.
I suppose that the regex crate is optional and not used by default for csr.
Beta Was this translation helpful? Give feedback.
All reactions