seed-rs / seed

A Rust framework for creating web apps
MIT License
3.8k stars 153 forks source link

Ideas for (internal) improvements #385

Open MartinKavik opened 4 years ago

MartinKavik commented 4 years ago
rebo commented 4 years ago

All the above excellent brainstorming, obviously crucial to the moment is systematic profiling / benchmarking to understand the effect of any of the above potential improvements.

MartinKavik commented 4 years ago

Note: I've just added into the above list this link - https://github.com/initcrash/seed-quickstart/pull/1. Is the result of the investigation of the slow first rendering in the app with many nodes. I just though it would be interesting for you. (cc @akhilman, @rebo)

rebo commented 4 years ago

Regarding your Node caching comments on the pull request. This is currently working as part of the hooks infrastructure. I'll upload an example later.

akhilman commented 4 years ago

WebAssembly Interface Types may also change performance in the future.

flosse commented 3 years ago

I just compared the filesize of the counter example:

That's a huge difference. Does s.o. know what's the main reason for this?

All were optimized with:

[profile.release]
lto = true
opt-level = 'z'
codegen-units = 1
MartinKavik commented 3 years ago

I just compared the filesize of the counter example: ...

The related issue comment: https://github.com/krausest/js-framework-benchmark/pull/854#issuecomment-770836519

flosse commented 3 years ago

I just compared the filesize of the counter example: ...

The related issue comment: krausest/js-framework-benchmark#854 (comment)

thx!

akhilman commented 3 years ago

I did twiggy dominators against counter example compiled in debug mode. Here is result. Seems like serde uses a lot of binary size. We could replace serde json by browsers's json serialization. == update == Or put serde/serialization behind feature flag.

MartinKavik commented 3 years ago

@akhilman If you think you can remove Serde or other dependencies, I will be very glad for a PR. If not possible, then feature flag would be also nice.

akhilman commented 3 years ago

@akhilman If you think you can remove Serde or other dependencies, I will be very glad for a PR. If not possible, then feature flag would be also nice.

I've got deeper look and seems we can not just drop serde_json:

Positive part:

Todomvc size comparison is not so dramatic:

Both includes serde_json.

MartinKavik commented 3 years ago

The large file size caused by Serde seems to be a known fact - https://github.com/serde-rs/serde/issues/286

If we can't remove Serde, can we replace it? I've found some potential options:

flosse commented 3 years ago
* https://crates.io/crates/miniserde

This one looks promising ... probably we can use it behind a feature flag?

MartinKavik commented 3 years ago

MoonZoon uses serde-lite (without problems so far) instead of miniserde because miniserde is too limited - e.g. it supports only structs according to its docs. However I can imagine both can be hidden behind an associated feature flag. Feel free to create a PR if you manage to make at least one of them work and it really helps your wasm file size.