Merge pull request #25333 from peppy/fix-spinner-performance

Fix all spinner ticks being alive and causing performance degradation
This commit is contained in:
Bartłomiej Dach 2023-11-02 09:07:44 +01:00 committed by GitHub
commit b7ab886848
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -275,6 +275,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
if (spinningSample != null && spinnerFrequencyModulate)
spinningSample.Frequency.Value = spinning_sample_modulated_base_frequency + Progress;
// Ticks can theoretically be judged at any point in the spinner's duration.
// A tick must be alive to correctly play back samples,
// but for performance reasons, we only want to keep the next tick alive.
var next = NestedHitObjects.FirstOrDefault(h => !h.Judged);
// See default `LifetimeStart` as set in `DrawableSpinnerTick`.
if (next?.LifetimeStart == double.MaxValue)
next.LifetimeStart = HitObject.StartTime;
}
protected override void UpdateAfterChildren()

View File

@ -11,8 +11,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
public override bool DisplayResult => false;
protected DrawableSpinner DrawableSpinner => (DrawableSpinner)ParentHitObject;
public DrawableSpinnerTick()
: this(null)
{
@ -29,10 +27,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
base.OnApply();
// the tick can be theoretically judged at any point in the spinner's duration,
// so it must be alive throughout the spinner's entire lifetime.
// this mostly matters for correct sample playback.
LifetimeStart = DrawableSpinner.HitObject.StartTime;
// Lifetime will be managed by `DrawableSpinner`.
LifetimeStart = double.MaxValue;
}
/// <summary>