Skip to content

Editor improvements test#4565

Open
AiAe wants to merge 2 commits into
Quaver:developfrom
AiAe:editor-improvements-test
Open

Editor improvements test#4565
AiAe wants to merge 2 commits into
Quaver:developfrom
AiAe:editor-improvements-test

Conversation

@AiAe
Copy link
Copy Markdown
Member

@AiAe AiAe commented Dec 30, 2025

Summary of changes:

  • Centralized Event Dispatching: Moved event subscriptions for HitObjectColoring and SelectedHitObjects from individual EditorHitObjectKeys instances to the EditorPlayfield.
  • Fast Lookup: Added a HitObjectMap (Dictionary) in EditorPlayfield to allow $O(1)$ lookup of hit objects when events fire.
  • Improved Destruction Logic:
    • Updated EditorPlayfield.Destroy() to skip the individual Destroy() loop for maps with more than 1,000 objects, relying on Garbage Collection for cleanup since event references are now handled centrally and dropped instantly.
    • Centrally unsubscribing from bindables in $O(1)$ time, avoiding the $O(N^2)$ bottleneck.
  • Enhanced Editor Performance: By reducing the number of event subscriptions from 450,000 (90k objects * 5 events) to just 5, the overall performance of the editor during map loading and editing is also significantly improved.

These changes ensure that exiting the editor is near-instant even for maps with a very high number of hit objects, without affecting other editor components.

Tests

Tested with https://quavergame.com/mapset/map/27824

Stats from Local build + Quaver/Wobble#169 & #4564 vs Canary 1.7.0.12:

  1. With Visualizer Enabled

Raw Measurements

Stage Local (GB) Canary (GB) Δ Canary vs Local
Selecting song 1.14 1.20 +0.06 (+5.3%)
In editor 7.09 7.47 +0.38 (+5.4%)
Exiting editor 1.45 3.30 +1.85 (+127.6%)

Derived Stats

  • Peak memory (in editor):

    • Local: 7.09 GB
    • Canary: 7.47 GB
    • Difference: +0.38 GB (+5.4%)
  • Memory retained after exit (vs selecting song):

    • Local: +0.31 GB (1.45 − 1.14)
    • Canary: +2.10 GB (3.30 − 1.20)
  • Retention multiplier (Canary vs Local):

    • ~6.8× higher retained memory after exit

  1. Without Visualizer

Raw Measurements

Stage Local (GB) Canary (GB) Δ Canary vs Local
Selecting song 1.02 1.35 +0.33 (+32.4%)
In editor 1.50 1.80 +0.30 (+20.0%)
Exiting editor 1.43 1.94 +0.51 (+35.7%)

Derived Stats

  • Peak memory (in editor):

    • Local: 1.50 GB
    • Canary: 1.80 GB
    • Difference: +0.30 GB (+20.0%)
  • Memory retained after exit (vs selecting song):

    • Local: +0.41 GB (1.43 − 1.02)
    • Canary: +0.59 GB (1.94 − 1.35)
  • Retention multiplier (Canary vs Local):

    • ~1.4× higher retained memory after exit

ThreadScheduler.Run(() =>
{
HitObjects.ForEach(x => x.Destroy());
if (HitObjects.Count < 1000)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What does this 1000 mean here? What happens if the count is greater than or equal to that number?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated EditorPlayfield.Destroy() to skip the individual Destroy() loop for maps with more than 1,000 objects, relying on Garbage Collection for cleanup since event references are now handled centrally and dropped instantly.

From my testing even tho I'm not 100% sure I agree with the solution it does still free up a lot of memory combined with the rest of the changes.

But we can probably revert that line.

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