Skip to content

Commit

Permalink
Merge pull request #26788 from EVAST9919/scrolling-alloc
Browse files Browse the repository at this point in the history
Reduce allocation overhead in `ScrollingHitObjectContainer`
  • Loading branch information
peppy committed Jan 30, 2024
2 parents fc8fdb5 + 87f853f commit 99f4b2c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,12 @@ protected override void UpdateAfterChildrenLife()

// We need to calculate hit object positions (including nested hit objects) as soon as possible after lifetimes
// to prevent hit objects displayed in a wrong position for one frame.
// Only AliveObjects need to be considered for layout (reduces overhead in the case of scroll speed changes).
foreach (var obj in AliveObjects)
// Only AliveEntries need to be considered for layout (reduces overhead in the case of scroll speed changes).
// We are not using AliveObjects directly to avoid selection/sorting overhead since we don't care about the order at which positions will be updated.
foreach (var entry in AliveEntries)
{
var obj = entry.Drawable;

updatePosition(obj, Time.Current);

if (layoutComputed.Contains(obj))
Expand Down

0 comments on commit 99f4b2c

Please sign in to comment.