osu-framework icon indicating copy to clipboard operation
osu-framework copied to clipboard

Add a method to bypass masking checks

Open peppy opened this issue 7 years ago • 3 comments

Containers which have many (10k+) children and are guaranteed to never require masking checks can currently generate large overhead due to masking checks.

We should discuss a way to improve this, whether it means exposing a protected bool RequiresMasking to the user or otherwise.

peppy avatar Mar 01 '18 05:03 peppy

One important thing to note here: Masking checks mostly appear expensive in the profiler, because they are the first thing that re-computes an invalidated ScreenSpaceDrawQuad. If the masking checks wouldn't happen, ScreenSpaceDrawQuad would still get computed by the next function that requires it, and so I strongly suspect that this kind of optimization won't help much.

Am I missing something here?

Tom94 avatar Mar 01 '18 10:03 Tom94

No, you're possibly very correct. I'll do further testing.

peppy avatar Mar 01 '18 10:03 peppy

I tried this proposal and here are some results:

master proposal
master pr

While it's possible to gain some performance in update thread (and we can squeeze some more by overriding the value in more places), it affects the draw thread since ssdq calculations now happen in draw nodes which skipped masking check (or something along these lines). Also I don't think we have mentioned cases in-game (with 10k+ drawables) and for which we have (tables and what not), they must compute masking since they are generally located in scrollable context. Worth mentioning that in most cases we can get away with overriding ComputeIsMaskedAway => false and BufferedContainer exists.

framework diff for testing osu diff

EVAST9919 avatar Mar 31 '24 19:03 EVAST9919