-
-
Notifications
You must be signed in to change notification settings - Fork 828
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
Rework Event System #1402
Rework Event System #1402
Conversation
This is freaking awesome! Curious for my own learning: does this place an additional burden on code that clones/copies an event to allocate additional space on the heap? I'm assuming the Box can't be reused by copied instances right? |
Or building on that, does this place an additional burden on the transmission system to allocate additional space for every event? |
The virtual dom will receive one non-specific web event. That event is wrapped in an Rc so that it will not be cloned. The virtual dom will bubble that event to event handlers. Each event handler will downcast it to the specific event that is needed. Downcasting work will be duplicated if the event bubbles, but it should be fairly cheap. Downcasting in the event handler is what lets us do bundle splitting better. Once the event is downcast, calling any methods on it will get the needed data from it. For example if you call modifiers, it will build a modifiers struct every time instead of caching it. This is slightly inefficient, but because the old implementation used a depreciated old store of data we were doing this anyway.
On the web renderer, we should allocate less in general because we don't get all of the data eagerly when we receive an event. For native/liveview events, we just use the old serialized form of data so it should be the same. |
this branch needs the |
The branch was a few commits behind the main branch. I just pulled in the latest changes. (this happens automatically when the PR is merged) |
@ealmloff are you holding this for the 0.5 release? May be good to add a milestone tag for it |
Yes, everything breaking is for 0.5 |
There are three main goals here:
This is built on top of the better pointer events introduced in #1394
closes #1163
closes #93