Add early check for plugin graph cycles

Check after adding group edges, as after that LOOT only adds edges if
they don't cause a cycle. Adding tie-break edges is the step that takes
longest and scales the worst (by far), so failing before that would
provide a much better user experience.
This commit is contained in:
Oliver Hamlet
2021-07-19 19:21:30 +01:00
parent a03539ef65
commit a09c9f73ac
+9
View File
@@ -57,9 +57,18 @@ std::vector<std::string> SortPlugins(
groups.emplace(group.GetName(), group);
}
graph.AddGroupEdges(groups);
// Check for cycles now because from this point on edges are only added if
// they don't cause cycles, and adding tie-break edges is by far the slowest
// part of the process, so if there is a cycle checking now will provide
// quicker feedback than checking later.
graph.CheckForCycles();
graph.AddOverlapEdges();
graph.AddTieBreakEdges();
// Check for cycles again, just in case there's a bug that lets some occur.
// The check doesn't take a significant amount of time.
graph.CheckForCycles();
return graph.TopologicalSort();