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

Update Handle - Avoid Branching in OnUpdate loop #148

Open
mbaker3 opened this issue Sep 22, 2023 · 0 comments
Open

Update Handle - Avoid Branching in OnUpdate loop #148

mbaker3 opened this issue Sep 22, 2023 · 0 comments
Labels
effort-medium Standard - 2 to 4 hours priority-high Good candidate to bump to the top of your queue next time you need a task. type-chore Clean-up and optimization

Comments

@mbaker3
Copy link
Member

mbaker3 commented Sep 22, 2023

Update the iteration in UpdateHandle.UpdateSource_OnUpdate to avoid branching.

Currently there are disposed checks in the loop to guard against scenarios where the completion of a CallAfterHandle causes other handles or the main UpdateHandle to be disposed. This works but branching in such a hot loop to protected against edge cases is an unecessary performance penalty.

Consider breaking the OnUpdate iteration up into two phases.

  1. Update all CallAfterHandle instance
  2. Dispatch complete for each completed instance
@mbaker3 mbaker3 added effort-medium Standard - 2 to 4 hours priority-high Good candidate to bump to the top of your queue next time you need a task. type-chore Clean-up and optimization labels Sep 22, 2023
mbaker3 added a commit that referenced this issue Sep 23, 2023
If a CallAfterHandle's completion disposed another CallAfterHandle or the UpdateHandle itself within the stack the iteration would error/fail.

IsDisposed is now checked on each iteration. Improvements to the fix are described in #148
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort-medium Standard - 2 to 4 hours priority-high Good candidate to bump to the top of your queue next time you need a task. type-chore Clean-up and optimization
Projects
None yet
Development

No branches or pull requests

1 participant