elharo opened a new issue, #134:
URL: https://github.com/apache/maven-dependency-tree/issues/134

   ## Summary
   `FilteringDependencyNodeVisitor` calls `filter.accept(node)` once in 
`visit(...)` and again in `endVisit(...)`, so every node is filtered twice 
during a single traversal.
   
   ## Affected code
   
`src/main/java/org/apache/maven/shared/dependency/graph/traversal/FilteringDependencyNodeVisitor.java`
   - `visit(...)`: lines 64-74
   - `endVisit(...)`: lines 80-90
   
   ## Impact
   For an inexpensive filter this is a minor constant-factor waste. For 
expensive filters such as `AncestorOrSelfDependencyNodeFilter` (which walks to 
the root on each call), it doubles an already costly traversal and compounds 
the O(N·depth) cost of that filter.
   
   ## Suggested fix
   Cache the per-node filter result during the walk (e.g. a small map keyed by 
node, or compute once and reuse for visit/endVisit), or document that filters 
should be cheap/idempotent.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to