elharo opened a new issue, #271:
URL: https://github.com/apache/maven-remote-resources-plugin/issues/271
## Summary
`ModelUtils.mergePluginLists()` recomputes `orderAfterMerge(...)` ā and
calls `setPlugins`/`flushPluginMap` ā on **every** iteration of the
parent-plugin loop, even though the loop body already accumulates into
`assembledPlugins`.
`src/main/java/org/apache/maven/plugin/resources/remote/ModelUtils.java:81-117`
```java
for (Plugin parentPlugin : parentPlugins) {
...
// very important to use the parentPlugins List ...
List<Plugin> results =
ModelUtils.orderAfterMerge(assembledPlugins, parentPlugins,
childContainer.getPlugins());
childContainer.setPlugins(results);
childContainer.flushPluginMap();
}
```
`orderAfterMerge` walks both full plugin lists (`:121-163`) with
`results.contains`/`indexOf` linear scans.
## Impact
For P parent plugins this is O(P³) work in the worst case plus repeated map
flushes ā mostly negligible for typical plugin counts but quadratic-to-cubic
during supplemental-model merges with many plugins. The ordering result is
identical whether computed once at the end or per-iteration, so the
per-iteration call is pure waste.
## Suggested fix
Hoist `orderAfterMerge(...)` + `setPlugins`/`flushPluginMap` out of the loop
and compute them once after the loop finishes.
--
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]