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

listen() only updates display on value change #36

Merged
merged 4 commits into from
Jan 29, 2022
Merged

Conversation

georgealways
Copy link
Owner

listen stores the controller's previous value and only calls updateDisplay if the value has changed. Should alleviate #35.

Originally I thought that redundant assignments to an HTML input's value were free, and that the bottleneck was each controller making its own animation frame request. It turns out consolidating the loops didn't really have an impact on performance.

With this PR, listen has negligible performance impact until values actually change: I'm able to add 1000 non-updating (yet listening) controllers in the new examples/listen-stress demo without dropping frames (2018 MPB). I'm able to get around 80 continuously updating controllers, but I think this bottleneck is browser-side.

@georgealways georgealways merged commit 5a2f734 into dev Jan 29, 2022
@georgealways georgealways deleted the lazy-listen branch January 30, 2022 21:04
@georgealways georgealways mentioned this pull request Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant