Add a method to bypass masking checks
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.
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?
No, you're possibly very correct. I'll do further testing.
I tried this proposal and here are some results:
| master | proposal |
|---|---|
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.