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

Reimplement ledger lines #24011

Merged
merged 2 commits into from
Aug 14, 2024

Commits on Aug 13, 2024

  1. Reimplement ledger lines

    Two things are bad about the current way we do ledger lines.
    
    a) They are implemented as a linked list, with the Chord holding the pointer to the first LedgerLine of the list and each LedgerLine holding a pointer to the next. This makes zero sense: it makes the list slower to traverse, it wastes memory, and it makes the code uglier for no reason. I've now reimplemented it with the Chord holding a vector of LedgerLines* instead.
    
    b) They are deleted and recreated at every single layout. This is a waste of resources, as we keep deleting and reallocating things in the heap for no reason, but most importanly has been the source of countless (meaning that I've literally lost count) memory bugs as anything that holds pointers to these LedgerLines (especially Shapes and now Skylines too) get invalidated. Now ledger lines are deleted / created only if necessary, i.e. only if the total number of ledger lines needed by the chord has changed. This should be, hopefully, the end of those memory bugs.
    mike-spa committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    45af023 View commit details
    Browse the repository at this point in the history
  2. review correction

    mike-spa committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    de9383d View commit details
    Browse the repository at this point in the history