I think that the current implementation of nearest wins rule can be improved so it has better performance.
Each time the graph walking algorithm is about to visit a child node (a dependency of a node) it checks whether that child node is not eclipsed or downgraded by any of the dependencies of parent nodes (direct and transitive). If a node is being ignored then all remaining dependencies on that branch of the graph are also ignored which is the key benefit of the "nearest wins" rule.
But, when we look closer at the code we can spot that it is implemented using linear search which is potentially bad for performance:
On the flip side, linear search is not always worse than a dictionary lookup - it all depends on the average number elements the linear search needs to go through. For narrow graphs, i.e. graphs where average number of dependencies of each node is low, the linear search can be equally fast or even outperform the dictionary lookup. Thus any change in this area needs to be well benchmarked using a representative set of solutions.
Details about Problem
I think that the current implementation of nearest wins rule can be improved so it has better performance.
Each time the graph walking algorithm is about to visit a child node (a dependency of a node) it checks whether that child node is not eclipsed or downgraded by any of the dependencies of parent nodes (direct and transitive). If a node is being ignored then all remaining dependencies on that branch of the graph are also ignored which is the key benefit of the "nearest wins" rule. But, when we look closer at the code we can spot that it is implemented using linear search which is potentially bad for performance:
On the flip side, linear search is not always worse than a dictionary lookup - it all depends on the average number elements the linear search needs to go through. For narrow graphs, i.e. graphs where average number of dependencies of each node is low, the linear search can be equally fast or even outperform the dictionary lookup. Thus any change in this area needs to be well benchmarked using a representative set of solutions.