-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance details #5
Comments
Because of the indirection from compiling Rust to JavaScript/WASM, it'll probably be likely to be slower than your typical React (and Redux), Preact, or Vue web app. |
True :) but how much slower. There may be many application that are still possible with this framework. A good stress test might be a data grid. Or maybe something else. |
@richardanaya Thank you for the request. I think I can do some checks on holidays 👍 I'll report here. |
I don't think wasm slower than js, if it does not call any js |
The difference might be that the modern frameworks have do a lot of optimization on performance. |
I've finished the first benchmark with Firefox 57.0.1 (64-bit) + pure wasm target Source: https://github.com/DenisKolodin/todomvc-perf-comparison |
Some frameworks have updated so much, but |
That's crazy! Definitely worth trying to implement an entry into this benchmark, though, as it's quite highly regarded. |
That does seem surprising. 👍 |
@rivertam https://github.com/krausest/js-framework-benchmark is a good option for benchmarking this framework 👍 I will implement it a little later. |
For large applications with deep hierarchy of components, yew can show the result worse than redux-like because yew has no alternative to |
I don't think this is necessarily true. I'm looking a bit more closely into Elm, and it doesn't have this idea of So it doesn't require you to write some logic to help the vdom algorithm do its thing, yet the benchmarks I've seen so far (like the one above) are indicating that Elm is actually quite a bit faster. This is probably worth a read : http://elm-lang.org/blog/blazing-fast-html-round-two |
Quick follow up, the first version of the article goes a little deeper into technical details, the part about laziness is pretty key I think. However, with Yew's model being mutable I'm not sure we can achieve the same thing. |
Laziness via immutable is one of the ways to implement idea of Yes, the use of immutable structures is the simplest to do such optimizations. Another way is vuex-like approach, which is not very useful in Rust. Immutable storages have other advantages also: cheap time travel, optimization aggregate functions via selectors and so on. In theory, it may be possible to use merle trees or iterative hashing to determine differences after every @deniskolodin what do you think about immutable data ( |
Another thing about performance: I think yew should separate the stage of building patch and the stage of applying patch (like in virtual-dom library). It allows to apply patches in the main ui thread, while the application works in web workers. |
So in a normal setting with the I've seen some comments here saying it would be slower, but judging at the benchmark (even when its old!) shows that there is certain prominence here. What are sort of the points in which the speed can be improved? |
@deniskolodin Any progress on a better benchmark? I checked the TodoMVC application (in an attempt to see if I could bump the React version for better reference), and unfortunately found that the Yew benchmark has quite a different UI than the other benchmarks, rendering it invalid. |
Any update on this? Someone said that yew would be slow (presumably compared to something like react) but I'm not sure how credible that claim is.. |
I contributed yew dcd3834 and stdweb 0.48.0 benchmarks to https://github.com/krausest/js-framework-benchmark . |
Thanks @saturday06, it seems to be quite slow and memory-intensive (also my experience in my current app). Do you have any idea how this can be improved? E.g. I often find myself having to clone state structs that are passed down to children as properties, is there a way to only pass them by reference? |
So... how do we fix this? |
@saturday06 Excellent work! It's the first good benchmark and it's time to start improving the performance. I'll explore this issue and how to speed it up 🚀 |
It'd be interesting to redo the Yew benchmarks with the fast Wasm to JS calls: |
yew included in Round 8: |
* in yewstack org * Initial implementation using an iterator adaptor to provide a coherent struct to implement Into<VNode> (via From<>) for * update large table example to demonstrate new .html() method instead of 'for' * ran cargo fmt * Add a section for project templates to the README * Change org to YewStack * Implement FromIterator instead of wrapping iterator * remove dead code * ran fmt * Add extend method to Classes * change to union * renamed union back to extend * removed unused import of RangeFull
* Early msgs queue for Public worker * Early msgs queue for Public worker * update (#1) * Fix typo * Require fmt in travis script * Apply cargo format to all modules * ?? * Merge (#2) * Fix typo * Require fmt in travis script * Apply cargo format to all modules * avoid allocating in diff_classes * avoid allocating for diff_kind * avoid allocating for diff_value * simplify diff_attributes and avoid allocations * return iterator for diff_classes and diff_attributes * rustfmt on vtags * clean apply_diff * more cleaning * apply suggestions * Update proc-macro2, syn and quote to 1.0 CLOSES #590 * Fixed typo * Add support for optional callbacks to component properties * Add tests for a component with optional callback * Fix typo * Add `Classes` to prelude * binary ser/de issue fix * merge (#3) * Fix typo * Require fmt in travis script * Apply cargo format to all modules * avoid allocating in diff_classes * avoid allocating for diff_kind * avoid allocating for diff_value * simplify diff_attributes and avoid allocations * return iterator for diff_classes and diff_attributes * rustfmt on vtags * clean apply_diff * more cleaning * apply suggestions * Update proc-macro2, syn and quote to 1.0 CLOSES #590 * Fixed typo * Add support for optional callbacks to component properties * Add tests for a component with optional callback * Fix typo * Add `Classes` to prelude * added bincode type for data ser de * fixed Into func * Update (#5) * in yewstack org * Initial implementation using an iterator adaptor to provide a coherent struct to implement Into<VNode> (via From<>) for * update large table example to demonstrate new .html() method instead of 'for' * ran cargo fmt * Add a section for project templates to the README * Change org to YewStack * Implement FromIterator instead of wrapping iterator * remove dead code * ran fmt * Add extend method to Classes * change to union * renamed union back to extend * removed unused import of RangeFull * update * Fix touch events (#656) * Update changelog for v0.9 release (#657) * Implement Debug for ChildRenderer<T> (#655) * Implement Debug for ChildRenderer<T> * fix formatter type lifetime * remove fmt * cargo fmt * Emit initial route to router subscribers (#634) * Fix typo in RenderService (#658) * Add From<&String> for Classes implementation * @jstarry feedback - cargo fmt - rename DEDICATED_WORKERS_* to REMOTE_AGENTS_* - remove unrelated changes * TypeId ask key instead &str * Remove .gitignore changes * Update agent.rs * Update agent.rs * Fix merge conflict
* Early msgs queue for Public worker * Early msgs queue for Public worker * update (#1) * Fix typo * Require fmt in travis script * Apply cargo format to all modules * ?? * Merge (yewstack#2) * Fix typo * Require fmt in travis script * Apply cargo format to all modules * avoid allocating in diff_classes * avoid allocating for diff_kind * avoid allocating for diff_value * simplify diff_attributes and avoid allocations * return iterator for diff_classes and diff_attributes * rustfmt on vtags * clean apply_diff * more cleaning * apply suggestions * Update proc-macro2, syn and quote to 1.0 CLOSES yewstack#590 * Fixed typo * Add support for optional callbacks to component properties * Add tests for a component with optional callback * Fix typo * Add `Classes` to prelude * binary ser/de issue fix * merge (yewstack#3) * Fix typo * Require fmt in travis script * Apply cargo format to all modules * avoid allocating in diff_classes * avoid allocating for diff_kind * avoid allocating for diff_value * simplify diff_attributes and avoid allocations * return iterator for diff_classes and diff_attributes * rustfmt on vtags * clean apply_diff * more cleaning * apply suggestions * Update proc-macro2, syn and quote to 1.0 CLOSES yewstack#590 * Fixed typo * Add support for optional callbacks to component properties * Add tests for a component with optional callback * Fix typo * Add `Classes` to prelude * added bincode type for data ser de * fixed Into func * Update (yewstack#5) * in yewstack org * Initial implementation using an iterator adaptor to provide a coherent struct to implement Into<VNode> (via From<>) for * update large table example to demonstrate new .html() method instead of 'for' * ran cargo fmt * Add a section for project templates to the README * Change org to YewStack * Implement FromIterator instead of wrapping iterator * remove dead code * ran fmt * Add extend method to Classes * change to union * renamed union back to extend * removed unused import of RangeFull * update * Fix touch events (yewstack#656) * Update changelog for v0.9 release (yewstack#657) * Implement Debug for ChildRenderer<T> (yewstack#655) * Implement Debug for ChildRenderer<T> * fix formatter type lifetime * remove fmt * cargo fmt * Emit initial route to router subscribers (yewstack#634) * Fix typo in RenderService (yewstack#658) * Add From<&String> for Classes implementation * @jstarry feedback - cargo fmt - rename DEDICATED_WORKERS_* to REMOTE_AGENTS_* - remove unrelated changes * TypeId ask key instead &str * Remove .gitignore changes * Update agent.rs * Update agent.rs * Fix merge conflict
Missing label:
|
* initial * handle button * handle button * remove std_web * merge * revert * Fix unresolved import error. (#5) * fix yew-stdweb Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com> Co-authored-by: Justin Starry <justin.starry@icloud.com>
@voidpumpkin, assigning this to you since you're working on it and it's mentioned in the documentation |
@hamza1311 , can we close this issue? It's been over a year. |
This is a very impressive framework. I would offer it would be useful to know about the performance of it's use. If there are best strategies or bad practices to be avoided. Also it would be useful as evidence for people considering it in production projects vs other frameworks.
The text was updated successfully, but these errors were encountered: