gnodet commented on PR #2014: URL: https://github.com/apache/maven-resolver/pull/2014#issuecomment-5222288445
The DF collector benefits from all four optimizations equally — it uses the same `DataPool` + `GraphKey` subtree caching as BF, and calls `deriveChildManager()` in its `doRecurse()` method identically. Specifically: 1. **Instance reuse** — DF calls `deriveChildManager(context)` at every node in `doRecurse()`. Returning `this` when nothing changes avoids allocation and restores pool cache transparency (the `GraphKey` includes the manager, so identical-but-distinct instances were defeating cache lookups — same issue as BF). 2. **Key caching + MMap.equals() short-circuits** — `GraphKey.equals()` performance improves for both collectors since they share `DataPool`. 3. **Cons-list parent pointer** — the O(1) derive replaces the O(depth) ArrayList copy in the manager itself, independent of collector. DF's recursive traversal pattern actually makes it slightly *more* sensitive to `deriveChildManager()` cost than BF. All tests pass with both collectors and all three manager subclasses. The PR body already notes this: "Full resolver test suite passes (BF + DF collectors, all three managers)." -- 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]
