You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace O(N^2) Set-merge traversal with O(N) post-order DFS for list form (#213)
The previous list-form implementation built each node's result by iterating
over every child's full transitive Set and re-adding items into the parent Set.
For K files sharing a common package with M transitive deps this cost O(K*M)
Set.add calls, and the spread push(...subTree) over a large Set risked a
RangeError on very deep trees.
The new traverseList / traverseListHelper pair does a single post-order DFS
with one seen Set for cycle/duplicate detection, visiting each file exactly
once and pushing it to the result array after its children - O(N) in unique
files with identical output order.
0 commit comments