Skip to content

Tighten gameplay hot paths by removing redundant hitobject traversal in note-lock and hitsound selection - #347

Merged
winnerspiros merged 2 commits into
masterfrom
copilot/optimize-performance-android
May 21, 2026
Merged

Tighten gameplay hot paths by removing redundant hitobject traversal in note-lock and hitsound selection#347
winnerspiros merged 2 commits into
masterfrom
copilot/optimize-performance-android

Conversation

Copilot AI commented May 21, 2026

Copy link
Copy Markdown

The issue was unnecessary per-input work in gameplay-critical logic, with the constraint to keep observable behavior unchanged. This change re-reviews and simplifies traversal paths, including removing fallback paths where they do not alter outcomes.

  • StartTimeOrderedHitPolicy: top-level, time-bounded scan

    • Limits blocking/miss checks to top-level alive objects before the target time.
    • Keeps note-lock semantics unchanged (DrawableHitCircle remains the only blocker).
    • Reduces work in dense slider-heavy sections by avoiding irrelevant traversal.
  • GameplaySampleTriggerSource: single-pass candidate/bounds selection

    • Replaces repeated entry scans with single-pass min/max bound resolution.
    • Selects the next valid lifetime entry without redundant passes.
    • Removes unnecessary fallback handling where result selection is unchanged.
  • Nested hitsound lookup: allocation-aware traversal

    • Uses iterative traversal with a reusable scratch list for nested objects.
    • Preserves “earliest valid nested sample” behavior while reducing per-call overhead and GC pressure.
private (HitObjectLifetimeEntry? first, HitObjectLifetimeEntry? last) getEntryBounds()
{
    HitObjectLifetimeEntry? first = null;
    HitObjectLifetimeEntry? last = null;

    foreach (var entry in hitObjectContainer.Entries)
    {
        if (first == null || entry.HitObject.StartTime < first.HitObject.StartTime)
            first = entry;

        if (last == null || entry.HitObject.StartTime > last.HitObject.StartTime)
            last = entry;
    }

    return (first, last);
}

Copilot AI and others added 2 commits May 21, 2026 16:05
@gitar-bot

gitar-bot Bot commented May 21, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

@winnerspiros
winnerspiros marked this pull request as ready for review May 21, 2026 16:58
Copilot AI review requested due to automatic review settings May 21, 2026 16:58
@winnerspiros
winnerspiros merged commit 58d9792 into master May 21, 2026
16 of 26 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants