-
-
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
Dev/listener multiplexer #1542
Dev/listener multiplexer #1542
Conversation
web_sys implementaion compiles but the std_web implementation is unfinished. Keeping this only to commit curretn progress before reverting std_web.
Feature parity with master, except for bubbling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will take a closer look at the code itself, here are just a few things I noticed.
Co-authored-by: Simon <simon@siku2.io>
Co-authored-by: Simon <simon@siku2.io>
Co-authored-by: Simon <simon@siku2.io>
Co-authored-by: Simon <simon@siku2.io>
I feel that enabling event bubbling is a better dev experience. I would prefer it to be the default, but devs can choose to optimize for performance and disable if it needed. I just ran perf benchmarks. The partial update improvements are great and expected! I'm curious what made row creation slow down though, any ideas? |
So a feature to not add HANDLE_BUBBLED to the callback flags by default?
I'd bet it's the listener equality check. I'm not too familiar with the VTag lifecycle yet. Does a diff on the exact same VTag (same view() call) ever happen? As far as I understand, that is the only scenario, when listeners can be equal. I have a feeling it's actually faster to never check listener equality and always replace them. |
Seems easybench-wasm does not support specifying a module path.
@jstarry Listener registration optimized. |
The conflicts are fine :)
|
@siku2 Master merged and all issues/comments addressed. |
Right, Components v2. I'll push a fix for benchmarks a bit later. This can be merged as is. |
PR yewstack#1542 didn't merge in the changes from yewstack#1989 correctly, this is fixed in this commit.
Description
Reduces the overhead of creating and dropping event listeners on each patch by registering them inside a global multiplexer. Also provides opt-in callback flags to additionally increase performance at the user's discretion.
Features:
The core functionality is done, so making this ahead of completion to potentially speed up the review.
Fixes #943
Breaking change
Handling bubbled events by default is expensive. This is the current behaviour in yew. With this PR events do not bubble by default and instead users have to either make a small change to their code or opt into a global deoptimization for that specific event kind.
Example:
becomes
Or, in case the user really wants event bubbling:
This causes all click events globally to perform upward DOM tree traversal to find any other listeners to call.
Checklist: