Judging by the "logs" it seems the is_first_in_measure attribute is being recalculated for every remaining beat when one beat gets deleted, so this is currently O(n^2). We should be able to avoid that easily by setting a flag to prevent recalculation or, more easily, by deleting in reverse chronological order, as recalculation in only triggered for beats after the deleted one.
Judging by the "logs" it seems the
is_first_in_measure
attribute is being recalculated for every remaining beat when one beat gets deleted, so this is currently O(n^2). We should be able to avoid that easily by setting a flag to prevent recalculation or, more easily, by deleting in reverse chronological order, as recalculation in only triggered for beats after the deleted one.