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

Improve performance of DrawVisualiser #1147

Merged
merged 5 commits into from
Nov 11, 2017

Conversation

smoogipoo
Copy link
Contributor

Previously it would iterate over every container and perform a FirstOrDefault on it to figure out whether a VisualisedDrawable existed/should be updated. With many drawables, this was super expensive, tending towards O(n^2) in worst case, plus other O(n) loops over visualised drawables.

I noticed this as a hot line when profiling:
screen shot 2017-11-10 at 7 23 49 pm

This changes makes DrawVisualiser instead respond to additions/removal from AliveInternalChildren, and caches the VisualisedDrawables, removing the need for expiry/reconstruction and more O(n) searching.

Along with this, these changes also seem to fix the flickering present due to the expiries inside VisualisedDrawable, such as in the case of TestCaseBlending.

@peppy peppy merged commit 3a2a4b4 into ppy:master Nov 11, 2017
@smoogipoo smoogipoo deleted the drawvis-performance-improvements branch February 22, 2018 04:11
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.

None yet

2 participants