-
Notifications
You must be signed in to change notification settings - Fork 567
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
Refactor WidgetPod::event. #1001
Conversation
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.
I see the benefit. I'm a little hesitant about needs_merge
; I think this method is getting to the point where we really want to start worrying about its complexity and the difficulty of reasoning about behaviour as we make changes in the future, and I think that it might be worth optimizing for reduced complexity at the cost of small runtime costs, and in the cases where merging would be skipped I expect skipping will be at best a verrrry small win?
druid/src/core.rs
Outdated
// If we need to replace either the event or its data. | ||
let mut modified_event = None; | ||
// Tracking whether we need to merge our state up to the parent. | ||
let mut needs_merge = false; |
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.
is this an optimization (my assumption), or are there times when merging would be incorrect?
if an optimization: my gut feeling is that merging is only a trivial amount of work in the general case, such that this optimization is unlikely to be meaningful even over very large graphs, and I'm not sure it's something it is worth adding more logic to handle, at least without being guided by a concrete performance concern?
I don' think the |
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.
great, thanks!
This PR is just the refactoring part of #986 so that we can get the refactoring in first and make the command targeting work more clear.
This new approach is more like
WidgetPod::lifecycle
. It doesn't copy/clone as much and is fewer lines of code allowing for easier understanding.