View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0007274 | ardour | bugs | public | 2017-03-07 11:51 | 2020-04-19 20:18 |
Reporter | timbyr | Assigned To | timbyr | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 5.8 | ||||
Fixed in Version | 5.X git (version in description) | ||||
Summary | 0007274: Loading Session with selected regions can take a really long time | ||||
Description | Tested 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 | ||||
Tags | No tags attached. | ||||
|
|
|
should be much improved since f31e938da0 |
|
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? |
|
sorry, had not rebased or pushed. it is 54bab5153f1cb |
|
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. |
|
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. |
|
|
|
7274-fix-freeze-on-undo.patch (936 bytes)
diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index 1a95f8c..72b8f0e 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -1531,6 +1531,8 @@ Selection::set_state (XMLNode const & node, int) clear_tracks (); clear_markers (); + RegionSelection selected_regions; + PBD::ID id; XMLNodeList children = node.children (); for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) { @@ -1555,7 +1557,7 @@ Selection::set_state (XMLNode const & node, int) editor->get_regionviews_by_id (id, rs); if (!rs.empty ()) { - add (rs); + selected_regions.insert (selected_regions.end(), rs.begin(), rs.end()); } else { /* regionviews haven't been constructed - stash the region IDs @@ -1715,6 +1717,9 @@ Selection::set_state (XMLNode const & node, int) } + // now add regions to selection at once + add (selected_regions); + return 0; } |
|
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 |
|
I can commit the fix if there is some agreement that this is an acceptable solution for now. |
|
patch looks ideal to me. it won't even conflict with the "selection2" branch. please commit it. |
|
that said, there is another approach ... but i think they are 6 of 1, half a dozen of the other; put a PresentationInfo::ChangeSuspender in scope while the regions are added to the selection. |
|
OK, well I've pushed the patch to master as 1b2bc203a or nightly build >= 5.8.574 I'm marking this issue as resolved. |
|
Issue has been closed automatically, by Trigger Close Plugin. Feel free to re-open with additional information if you think the issue is not resolved. |
Date Modified | Username | Field | Change |
---|---|---|---|
2017-03-07 11:51 | timbyr | New Issue | |
2017-03-07 11:51 | timbyr | File Added: Ardour.trace.load-session-with-region-selection.json.tar.xz | |
2017-04-02 17:37 | paul | Note Added: 0019582 | |
2017-04-02 22:28 | timbyr | Note Added: 0019584 | |
2017-04-02 22:34 | paul | Note Added: 0019585 | |
2017-04-03 00:59 | timbyr | Note Added: 0019589 | |
2017-04-20 12:10 | timbyr | Note Added: 0019615 | |
2017-04-20 12:10 | timbyr | File Added: Ardour-5.8.533-split-region-with-selection-undo.json.gz | |
2017-04-23 11:23 | timbyr | File Added: 7274-fix-freeze-on-undo.patch | |
2017-04-23 11:29 | timbyr | Note Added: 0019625 | |
2017-04-23 11:31 | timbyr | Note Added: 0019626 | |
2017-04-23 17:04 | paul | Note Added: 0019629 | |
2017-04-23 17:05 | paul | Note Added: 0019630 | |
2017-04-23 22:59 | timbyr | Note Added: 0019635 | |
2017-04-23 23:00 | timbyr | Status | new => resolved |
2017-04-23 23:00 | timbyr | Fixed in Version | => 5.X git (version in description) |
2017-04-23 23:00 | timbyr | Resolution | open => fixed |
2017-04-23 23:00 | timbyr | Assigned To | => timbyr |
2020-04-19 20:18 | system | Note Added: 0023733 | |
2020-04-19 20:18 | system | Status | resolved => closed |