Open MartinKavik opened 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.
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)
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.
WebAssembly Interface Types may also change performance in the future.
I just compared the filesize of the counter example:
v0.8.0
: 383K
v0.17.4
: 71K
v0.2.0
: 80K
v0.34.0
: 148K
v0.3.6
: 94K
v0.5.14
: 58K
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
I just compared the filesize of the counter example: ...
The related issue comment: https://github.com/krausest/js-framework-benchmark/pull/854#issuecomment-770836519
I just compared the filesize of the counter example: ...
The related issue comment: krausest/js-framework-benchmark#854 (comment)
thx!
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.
@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 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.
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:
* https://crates.io/crates/miniserde
This one looks promising ... probably we can use it behind a feature flag?
- https://crates.io/crates/miniserde This one looks promising ... probably we can use it behind a feature flag?
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.
HashMaps
- e.g. use https://github.com/cbreeden/fxhash.BTreeMap
s andIndexMap
s.wasm-bindgen
-related optimizations:#[inline(..)]
(?).mpsc
with future-signals or crossbeam or flume (if possible).Box
/Rc
where it doesn't affect public API.Cow
with the beef one, if possible.web_sys
calls.Node
cacheable? (Related - https://github.com/seed-rs/seed/issues/443)App
initialization - https://github.com/seed-rs/seed/issues/277.Debug
s.Makefile.toml
(see the quickstart's one).