1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-20 11:42:55 +08:00
osu-lazer/osu.Game/Screens/Edit/Compose
Bartłomiej Dach f13ca28d5e
Fix performance overhead from ternary state bindable callbacks when selection is changing
Closes https://github.com/ppy/osu/issues/28369.

The reporter of the issue was incorrect; it's not the beat snap grid
that is causing the problem, it's something far stupider than that.

When the current selection changes,
`EditorSelectionHandler.UpdateTernaryStates()` is supposed to update the
state of ternary bindables to reflect the reality of the current
selection. This in turn will fire bindable change callbacks for said
ternary toggles, which heavily use `EditorBeatmap.PerformOnSelection()`.

The thing about that method is that it will attempt to check whether any
changes were actually made to avoid producing empty undo states, *but*
to do this, it must *serialise out the entire beatmap to a stream* and
then *binary equality check that* to determine whether any changes were
actually made:

	7b14c77e43/osu.Game/Screens/Edit/EditorChangeHandler.cs (L65-L69)

As goes without saying, this is very expensive and unnecessary, which
leads to stuff like keeping a selection box active while a taiko beatmap
is playing under it dog slow. So to attempt to mitigate that, add
precondition checks to every single ternary callback of this sort to
avoid this serialisation overhead.

And yes, those precondition checks use linq, and that is *still* faster
than not having them.
2024-06-04 10:32:12 +02:00
..
Components Fix performance overhead from ternary state bindable callbacks when selection is changing 2024-06-04 10:32:12 +02:00
ComposeScreen.cs Resolve Clipboard via DI 2023-07-11 11:42:31 +02:00
HitObjectUsageEventBuffer.cs Automated #nullable processing 2022-06-17 16:37:17 +09:00
IPlacementHandler.cs Automated pass 2023-06-24 01:00:03 +09:00