Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPTIMIZATION: Remove unnecessary calls to triggerLayoutAll #20141

Merged

Conversation

mike-spa
Copy link
Contributor

Resolves: #20003

The job of triggerLayout is to let the Score know that something has changed at this tick. That is done by calling Score::setLayout, which collects the changes into a range defined by a startTick and endTick. That is the region of the score for which the layout will be recomputed at the next round.

triggerLayoutAll signals that the whole score has changed, and therefore will cause the entire score to be recomputed. I suspect it mostly exist as a legacy hack, because in almost NO case does it make sense to layout the entire score after editing something. There can be situations where editing an item should cause the re-computation of something before and/or after it (for instance, putting a layout break on a measure should also trigger the layout of the following one), but those situations should be handled by simply overriding triggerLayout wherever necessary.

I have left triggerLayoutAll only in a few selected places now:

  • Change of system brackets (which do affect the whole score)
  • Change of instrument
  • Change of clef, time signature, key signature (and even in these cases, we can consider in future reducing the layout range to range affected by it, which isn't necessarily the whole score).

This needs to be carefully tested. A lot of editing operations should feel quicker on big scores now. The important thing to look out for is that the score always updates correctly after all editing operations @oktophonie @DmitryArefiev.

@DmitryArefiev
Copy link
Contributor

Tested #20003 on Win10 - FIXED

I didn't find any regressions comparing with master, but let's see what beta users find

Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Nov 22, 2023
@RomanPudashkin RomanPudashkin merged commit cb057e3 into musescore:master Nov 23, 2023
11 checks passed
@oktophonie oktophonie removed their request for review November 23, 2023 09:26
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Nov 23, 2023
RomanPudashkin added a commit to RomanPudashkin/MuseScore that referenced this pull request Dec 18, 2023
RomanPudashkin added a commit to RomanPudashkin/MuseScore that referenced this pull request Dec 18, 2023
@RomanPudashkin RomanPudashkin mentioned this pull request Dec 18, 2023
RomanPudashkin added a commit to RomanPudashkin/MuseScore that referenced this pull request Dec 18, 2023
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.

Change Slur Direction Very Slow
4 participants