mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
All master-flagged plugins must load before all non-master-flaggeg plugins, and this means that most of the edges added in the graph (about 2/3rds in large load orders) are just enforcing this. Having lots of edges negatively impacts the performance of checking for paths, and adding overlap edges is O(n^2), so instead of having one graph containing all plugins, create one graph for masters and another for plugins, and sort them independently, then append the non-masters order to the masters order. This speeds up my 1619 plugin sort from 44s to 34s, and larger load orders should see more benefit. This does introduce some behavioural changes though: - any requirement or load after metadata that tries to put a master after a non-master will now be ignored instead of causing a cyclic interaction error. A master-flagged plugin that has a non-master-flagged plugin will also no longer cause a cyclic interaction error, but that scenario is much less likely. - The resulting load order may differ slightly. When tie-breaking finds a path that contradicts the old load order, it pins the positions of plugins in the path. However, the lack of master flag edges causes later edges to be added or skipped differently. This is all ultimately down to the order of edge iteration mattering during path discovery (since it stops at the first path discovered), so even though the two approaches result in graphs that enforce the same relationships between plugins at the point that tie-breaking starts, ties may be broken differently due to differences in the edges enforcing those relationships.