Skip to content
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

Cleanup ImplicitClone related stuff in the examples #3508

Open
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

cecton
Copy link
Member

@cecton cecton commented Nov 1, 2023

Description

What does this PR do?

  1. Use more cheap-to-clone types in the examples
  2. Some examples got impacted by remove ToHtml trait #3453 (the removal of ToHtml), I fixed them so we can use reference where it makes sense (I added a few IntoPropValue on cheap-to-clone types)
  3. Updated implicit-clone to the latest version
  4. Optimized ChildrenRenderer memory allocations by using Rc

Changes did on the side:

  1. In order to get some example working, I had to change NodeSeq to use IArray. This is good because it is more optimized for memory allocations too
  2. Slightly improve the API of VChild to easily get a ref mut inside its properties object (just for convenience!)

Related to #3453

Checklist

  • I have reviewed my own code
  • I have added tests

github-actions[bot]
github-actions bot previously approved these changes Nov 1, 2023
Copy link

github-actions bot commented Nov 1, 2023

Benchmark - core

Yew Master

vnode           fastest       │ slowest       │ median        │ mean          │ samples │ iters
╰─ vnode_clone  2.47 ns       │ 3.034 ns      │ 2.473 ns      │ 2.486 ns      │ 100     │ 1000000000

Pull Request

vnode           fastest       │ slowest       │ median        │ mean          │ samples │ iters
╰─ vnode_clone  2.778 ns      │ 2.97 ns       │ 2.783 ns      │ 2.791 ns      │ 100     │ 1000000000

Copy link

github-actions bot commented Nov 1, 2023

Visit the preview URL for this PR (updated for commit 224e08b):

https://yew-rs-api--pr3508-cleanup-implicit-clo-xpmvce0a.web.app

(expires Sun, 26 Nov 2023 10:10:39 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Copy link

github-actions bot commented Nov 1, 2023

Benchmark - SSR

Yew Master

Benchmark Round Min (ms) Max (ms) Mean (ms) Standard Deviation
Baseline 10 289.308 290.260 289.563 0.272
Hello World 10 477.933 500.649 481.669 6.983
Function Router 10 1595.919 1625.613 1603.911 8.295
Concurrent Task 10 1005.827 1007.602 1006.562 0.529
Many Providers 10 1137.344 1190.735 1149.246 16.474

Pull Request

Benchmark Round Min (ms) Max (ms) Mean (ms) Standard Deviation
Baseline 10 289.470 290.042 289.685 0.179
Hello World 10 493.324 507.555 500.525 5.299
Function Router 10 1625.657 1644.951 1633.711 6.780
Concurrent Task 10 1005.268 1006.699 1006.241 0.472
Many Providers 10 1109.017 1125.740 1118.954 5.153

Copy link

github-actions bot commented Nov 1, 2023

Size Comparison

examples master (KB) pull request (KB) diff (KB) diff (%)
async_clock 100.268 100.273 +0.006 +0.006%
boids 173.785 174.488 +0.703 +0.405%
communication_child_to_parent 92.743 92.832 +0.089 +0.096%
communication_grandchild_with_grandparent 105.757 105.876 +0.119 +0.113%
communication_grandparent_to_grandchild 101.017 101.087 +0.070 +0.070%
communication_parent_to_child 89.086 89.167 +0.081 +0.091%
contexts 105.992 106.008 +0.016 +0.015%
counter 86.119 86.798 +0.679 +0.788%
counter_functional 86.507 87.036 +0.529 +0.612%
dyn_create_destroy_apps 88.983 89.560 +0.576 +0.648%
file_upload 99.992 100.283 +0.291 +0.291%
function_memory_game 172.397 173.153 +0.756 +0.438%
function_router 348.657 349.524 +0.867 +0.249%
function_todomvc 161.174 161.901 +0.728 +0.451%
futures 229.063 229.293 +0.229 +0.100%
game_of_life 110.172 110.262 +0.090 +0.082%
immutable 185.438 188.971 +3.532 +1.905%
inner_html 79.895 79.894 -0.001 -0.001%
js_callback 109.505 110.298 +0.793 +0.724%
keyed_list 199.575 200.350 +0.774 +0.388%
mount_point 82.785 82.786 +0.001 +0.001%
nested_list 113.885 116.348 +2.463 +2.163%
node_refs 90.323 90.403 +0.080 +0.089%
password_strength 1750.117 1750.190 +0.073 +0.004%
portals 93.461 94.175 +0.714 +0.764%
router 317.558 318.463 +0.905 +0.285%
simple_ssr 140.308 141.102 +0.794 +0.566%
ssr_router 385.899 386.830 +0.931 +0.241%
suspense 115.714 116.436 +0.722 +0.624%
timer 88.605 88.947 +0.342 +0.386%
timer_functional 97.970 98.859 +0.890 +0.908%
todomvc 141.336 142.071 +0.735 +0.520%
two_apps 85.824 85.826 +0.002 +0.002%
web_worker_fib 134.758 135.361 +0.604 +0.448%
web_worker_prime 184.959 184.998 +0.039 +0.021%
webgl 82.503 82.505 +0.002 +0.002%

⚠️ The following examples have changed their size significantly:

examples master (KB) pull request (KB) diff (KB) diff (%)
immutable 185.438 188.971 +3.532 +1.905%
nested_list 113.885 116.348 +2.463 +2.163%

github-actions[bot]
github-actions bot previously approved these changes Nov 1, 2023
github-actions[bot]
github-actions bot previously approved these changes Nov 1, 2023
github-actions[bot]
github-actions bot previously approved these changes Nov 6, 2023
github-actions[bot]
github-actions bot previously approved these changes Nov 6, 2023
github-actions[bot]
github-actions bot previously approved these changes Nov 6, 2023
github-actions[bot]
github-actions bot previously approved these changes Nov 6, 2023
github-actions[bot]
github-actions bot previously approved these changes Nov 6, 2023
github-actions[bot]
github-actions bot previously approved these changes Nov 6, 2023
github-actions[bot]
github-actions bot previously approved these changes Nov 6, 2023
github-actions[bot]
github-actions bot previously approved these changes Nov 6, 2023
github-actions[bot]
github-actions bot previously approved these changes Nov 6, 2023
@cecton
Copy link
Member Author

cecton commented Nov 6, 2023

@kirillsemyonkin now I think the benchmark results look good. Not a big improvement but not a lost either except maybe on the "baseline" but that's probably normal.

github-actions[bot]
github-actions bot previously approved these changes Nov 11, 2023
Comment on lines -205 to -218
impl Clone for Listeners {
fn clone(&self) -> Self {
match self {
Self::None => Self::None,
Self::Pending(v) => Self::Pending(v.clone()),
}
}
}

impl Default for Listeners {
fn default() -> Self {
Self::None
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why we did that manually but it was not necessary

github-actions[bot]
github-actions bot previously approved these changes Nov 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants