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

Assert there are no circular references #3025

Merged
merged 2 commits into from
Dec 10, 2022

Conversation

WorldSEnder
Copy link
Member

@WorldSEnder WorldSEnder commented Dec 10, 2022

Description

The removed check is costly in release builds and should always fail. Note that the current PartialEq impl of NodeRef is not symmetric, it's useful only to check for circular dependencies! This should be fixed as well, with an improved design.

Fixes #3024

Checklist

  • I have reviewed my own code

the check is costly in release builds and should always fail
note that the current PartialEq impl is *not* symmetric!
should be fixed as well, with an improved design
github-actions[bot]
github-actions bot previously approved these changes Dec 10, 2022
@WorldSEnder WorldSEnder added performance A-yew Area: The main yew crate labels Dec 10, 2022
@github-actions
Copy link

github-actions bot commented Dec 10, 2022

Visit the preview URL for this PR (updated for commit 111cb96):

https://yew-rs-api--pr3025-perf-node-link-1ppwmv1h.web.app

(expires Sat, 17 Dec 2022 13:49:17 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@github-actions
Copy link

github-actions bot commented Dec 10, 2022

Benchmark - SSR

Yew Master

Benchmark Round Min (ms) Max (ms) Mean (ms) Standard Deviation
Baseline 10 336.152 337.323 336.671 0.405
Hello World 10 615.036 618.946 616.207 1.371
Function Router 10 2212.743 2227.507 2217.956 4.635
Concurrent Task 10 1008.344 1010.040 1009.181 0.609

Pull Request

Benchmark Round Min (ms) Max (ms) Mean (ms) Standard Deviation
Baseline 10 336.188 352.839 338.226 5.162
Hello World 10 636.460 641.975 638.690 2.211
Function Router 10 2251.170 2272.460 2264.145 6.430
Concurrent Task 10 1008.530 1010.105 1009.477 0.514

@github-actions
Copy link

github-actions bot commented Dec 10, 2022

Size Comparison

examples master (KB) pull request (KB) diff (KB) diff (%)
async_clock 108.310 108.235 -0.074 -0.069%
boids 172.371 172.264 -0.107 -0.062%
communication_child_to_parent 92.453 92.359 -0.094 -0.101%
communication_grandchild_with_grandparent 106.933 106.802 -0.131 -0.122%
communication_grandparent_to_grandchild 102.785 102.653 -0.132 -0.128%
communication_parent_to_child 89.543 89.447 -0.096 -0.107%
contexts 109.500 109.333 -0.167 -0.153%
counter 87.457 87.386 -0.071 -0.082%
counter_functional 87.870 87.800 -0.070 -0.080%
dyn_create_destroy_apps 90.308 90.212 -0.096 -0.106%
file_upload 101.778 101.705 -0.073 -0.072%
function_memory_game 166.659 166.452 -0.207 -0.124%
function_router 350.629 350.148 -0.480 -0.137%
function_todomvc 161.571 161.415 -0.156 -0.097%
futures 226.608 226.534 -0.074 -0.033%
game_of_life 108.189 108.117 -0.072 -0.067%
immutable 184.158 184.000 -0.158 -0.086%
inner_html 83.878 83.808 -0.070 -0.084%
js_callback 113.158 113.008 -0.150 -0.133%
keyed_list 197.903 197.807 -0.097 -0.049%
mount_point 87.025 86.956 -0.069 -0.080%
nested_list 115.061 114.941 -0.119 -0.104%
node_refs 94.967 94.871 -0.096 -0.101%
password_strength 1553.443 1553.344 -0.100 -0.006%
portals 98.244 98.146 -0.099 -0.100%
router 320.612 320.236 -0.376 -0.117%
simple_ssr 153.147 153.052 -0.096 -0.062%
ssr_router 394.975 394.589 -0.386 -0.098%
suspense 110.831 110.675 -0.156 -0.141%
timer 90.328 90.255 -0.073 -0.081%
todomvc 142.821 142.749 -0.072 -0.051%
two_apps 88.080 88.016 -0.064 -0.073%
web_worker_fib 154.449 154.375 -0.074 -0.048%
webgl 86.604 86.532 -0.071 -0.082%

✅ None of the examples has changed their size significantly.

wasm_bindgen does not yet support #[should_panic]
see also rustwasm/wasm-bindgen#2286
ranile
ranile previously approved these changes Dec 10, 2022
Copy link
Member

@ranile ranile left a comment

Choose a reason for hiding this comment

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

Looks good! Have you tried running the benchmark locally to see if fixes the regression?

@WorldSEnder
Copy link
Member Author

Yeah locally it does. Something is really wrong with the github actions benchmark setup:

  • it measures no performance impact
  • the comment on the PR is missing

@WorldSEnder
Copy link
Member Author

WorldSEnder commented Dec 10, 2022

I have removed a test for the NodeRef::link method, which is exclusively used internally and pub(crate), so this should have no impact on user code. To repeat the commit comment why it can't be #[should_panic]: wasm_bindgen doesn't support this atm.

@ranile
Copy link
Member

ranile commented Dec 10, 2022

Can the link method be removed entirely?

@WorldSEnder
Copy link
Member Author

WorldSEnder commented Dec 10, 2022

Not that I know how. It's important for empty and nested components' to be able to forward their NodeRef to the ref of the next sibling node or nested node, so that a lifecycle there will automatically update the ref for all refs linking to it - if that makes sense.

Copy link
Member

@ranile ranile left a comment

Choose a reason for hiding this comment

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

Makes sense. Let's merge this change then

@WorldSEnder WorldSEnder merged commit 57f45e2 into yewstack:master Dec 10, 2022
@WorldSEnder WorldSEnder deleted the perf-node-link branch December 10, 2022 15:37
WorldSEnder added a commit to WorldSEnder/yew that referenced this pull request Jan 10, 2023
* assert there are no circular references

the check is costly in release builds and should always fail
note that the current PartialEq impl is *not* symmetric!
should be fixed as well, with an improved design

* remove internal test for cyclic node refs

wasm_bindgen does not yet support #[should_panic]
see also rustwasm/wasm-bindgen#2286
WorldSEnder added a commit that referenced this pull request Jan 19, 2023
* assert there are no circular references

the check is costly in release builds and should always fail
note that the current PartialEq impl is *not* symmetric!
should be fixed as well, with an improved design

* remove internal test for cyclic node refs

wasm_bindgen does not yet support #[should_panic]
see also rustwasm/wasm-bindgen#2286
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-yew Area: The main yew crate performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance regression in 0.20
2 participants