Masking sub-tree creation can be avoided with relative ease
Closed this issue · 3 comments
Also adresses #1432
While ComputeIsMaskedAway
isn't that expensive, iterating over children in complex scenes adds up. And we do that many times per composite. I tried to move all the masking computations into UpdateSubTree
and it works fine (or I was lucky and didn't encounter any issues so far) and we get performance benefits.
I understand though that this is not as easy as it sounds since it affects the whole update system and benefits are not that big, but may be for the future it's something to consider. Or not.
framework diff
osu-side diff
(I'll pr if that's a direction we want to go in)
master | proposal | |
---|---|---|
direct (600 items loaded) | ||
mods-overlay | ||
song-select + direct + beatmap overlay | ||
song-select |
I don't remember/don't think there's a particular reason why it's a separate pass.
Okay, there's a reason for that: that's to ensure all the updates/invalidations/whatever have taken place.
With my approach there are cases in which, for example, ScreenSpaceDrawQuad
is one frame outdated (content in ScrollContainer
) and as such IsMaskedAway
isn't "realtime". This has something to do with invalidation/validation timings and I'm not going into that rabbit hole.
Simpler example:
- child computes
IsMaskedAway
- parent moves the drawable in
UpdateAfterChildren()
IsMaskedAway
may no longer be valid
Closing as not as simple (may be even not possible) to implement as initially thought.
Hmm, it seems like it's possible to put masking calculations into GenerateDrawNodeSubTree
with similar benefits, still investigating.
I'll probably just open a pr when it's ready.