gnodet opened a new pull request, #2075: URL: https://github.com/apache/maven-resolver/pull/2075
## Summary - Replace per-node `HashSet<String>` copy with parent-chain walk for cycle detection in `PathConflictResolver.Path` - Each `Path` previously copied its parent's entire `conflictIdsOnPath` set (`new HashSet<>(parent.conflictIdsOnPath)` + `.add()`), which JFR profiling showed consumed **~45% CPU** on a 4,383-module reactor build (`HashSet.<init>` 16.4%, `AbstractCollection.addAll` 16.9%, `HashMap.put` 13.7%) - Since dependency tree depth is bounded in practice (< 30), the O(depth) walk per `hasConflictIdOnPathToRoot()` call is trivially fast while eliminating all HashSet allocation overhead ## Benchmark Results Tested on the [4,383-module generated reactor project](https://github.com/maven-turbo-reactor/maven-multiproject-generator), `clean install -DskipTests -q -B`, Apple M4 Pro, JDK 21: | Configuration | Wall time | vs RC6 | |---|---|---| | Maven 4.0.0-rc-6 (unpatched) | **2:12** | baseline | | Patched maven-4.0.x (all #12667 PRs, without this fix) | **2:25** | — | | + this HashSet elimination | **1:21** | **-39%** | | + install/deploy plugin fixes | **1:14** | **-44%** | | Maven 3.9.16 | **1:20** | — | With this fix applied alongside the other optimizations from #12667, Maven 4 is now **faster than Maven 3.9.16** on this benchmark. See: https://github.com/apache/maven/issues/12667 ## Test plan - [x] Existing `PathConflictResolver` unit tests pass - [x] Full `maven-resolver-util` test suite passes - [x] Benchmarked on 4,383-module reactor — correct build output, significant performance improvement 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
