View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007274ardourbugspublic2017-03-07 03:512017-04-23 04:31
Assigned To 
PlatformOSOS Version
Product Version5.8 
Target VersionFixed in Version 
Summary0007274: Loading Session with selected regions can take a really long time
DescriptionTested with version 5.8.76 + logging/tracing patches

In a moderate size session with several hundred regions if the Session is saved with many selected regions then the Session can take a very long time to load
compared to without a region selection (5 seconds vs 60+ seconds) depending on the number of regions selected.

As part of Editor::first_idle region/views that are selected are added to the region selection one region at a time calling Selection::add. Selection::add emits a signal that is connected to Editor::region_selection_changed that calls Editor::sensitize_the_right_region_actions which itself is > O(n2) as it iterates through the RegionSelection calling Region::at_natural_position which calls Session::find_whole_file_parent which also iterates through all the regions in the Session AFAICT. So the whole process ends up being > O(n3).

It is also an issue for normal region selection in that Editor::sensitize_the_right_region_actions is called, but at least only once.

It is probably just easier to understand by looking at log/trace file I've attached that can be viewed with chrome/ium://tracing
TagsNo tags attached.
Attached Files? file icon Ardour.trace.load-session-with-region-selection.json.tar.xz [^] (3,049,596 bytes) 2017-03-07 03:51
gz file icon Ardour-5.8.533-split-region-with-selection-undo.json.gz [^] (1,173,315 bytes) 2017-04-20 05:10
patch file icon 7274-fix-freeze-on-undo.patch [^] (936 bytes) 2017-04-23 04:23 [Show Content]

- Relationships

-  Notes
paul (administrator)
2017-04-02 10:37

should be much improved since f31e938da0
timbyr (developer)
2017-04-02 15:28

I can't find a commit with that id in the master branch. Are you are sure that is correct? or is it located somewhere else?
paul (administrator)
2017-04-02 15:34

sorry, had not rebased or pushed. it is 54bab5153f1cb
timbyr (developer)
2017-04-02 17:59

Testing with a build of 54bab5153 and the load time is now much reduced.

I did notice though that after selecting a region and deleting it then undoing the action will no longer result in the region begin re/selected.
timbyr (developer)
2017-04-20 05:10

There seems to be a related issue that I can reproduce in 5.8.236 and 5.8.533.

Steps to reproduce:

1. Create or open a Session with many regions. Several hundred should make the issue noticable.
2. Select all the regions in the Session.
3. Split a region using split tool or 's' key.
4. Undo the Split.

Result: Depending on the amount of Regions in the Session the application will freeze for a period of time, several seconds to perhaps minutes depending on number of Regions selected.

I've attached another trace/log that makes it apparent it is a similar issue with regions being added individually to the selection.
timbyr (developer)
2017-04-23 04:29

I've attached a patch that should fix the issue mentioned in the last comment.

It feels like more of a workaround as there is still the issues with Editor::sensitize_the_right_region_actions
timbyr (developer)
2017-04-23 04:31

I can commit the fix if there is some agreement that this is an acceptable solution for now.

- Issue History
Date Modified Username Field Change
2017-03-07 03:51 timbyr New Issue
2017-03-07 03:51 timbyr File Added: Ardour.trace.load-session-with-region-selection.json.tar.xz
2017-04-02 10:37 paul Note Added: 0019582
2017-04-02 15:28 timbyr Note Added: 0019584
2017-04-02 15:34 paul Note Added: 0019585
2017-04-02 17:59 timbyr Note Added: 0019589
2017-04-20 05:10 timbyr Note Added: 0019615
2017-04-20 05:10 timbyr File Added: Ardour-5.8.533-split-region-with-selection-undo.json.gz
2017-04-23 04:23 timbyr File Added: 7274-fix-freeze-on-undo.patch
2017-04-23 04:29 timbyr Note Added: 0019625
2017-04-23 04:31 timbyr Note Added: 0019626

Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker