[PERF] Maven 4 performance on large reactors — 2:4 5 → 1:18 (parity with Maven 3)

Guillaume Nodet <[email protected]> Mon, 3 Aug 2026 14:01:22 +0200
Newsgroups gmane.comp.jakarta.turbine.maven.devel
Message-ID <CAA66Tpr8MULLVh7V87H2tq8WiGvdeMJdH3MbT8Af5WP_jOfXQQ@mail.gmail.com>
--000000000000a572520658234c5c
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi all,

I've been profiling Maven 4 RC6 on a large reactor (4,383 modules,
diamond-graph, generated with maven-multiproject-generator) as several
performance regressions were found during in the vote thread compared to
Maven 3. A clean install -DskipTests that takes ~1:15 on Maven 3.9.16 was
taking ~2:45 on Maven 4 RC6.

After a series of JFR-guided optimizations across 4 repositories, Maven 4
now completes the same build in ~1:18 =E2=80=94 at parity with Maven 3.

Benchmark (Apple M4 Pro, JDK 21):

| Configuration | Wall time |
|----------------------------|----------------|
| Maven 3.9.16 | 1:14 =E2=80=93 1:18 |
| Maven 4 RC6 (unpatched) | 2:45 |
| + all optimizations | 1:18 |

The full analysis (JFR hotspots, root causes, complexity reductions) and
all 8 PRs are tracked in:
https://github.com/apache/maven/issues/12667

The main wins are:
1. Switching the default conflict resolver from classic (O(N=C2=B2)) to pat=
h
(O(N)) =E2=80=94 single biggest win, 2:45 =E2=86=92 1:45
2. TransitiveDependencyManager optimizations =E2=80=94 instance reuse, cons=
-list
parent pointer, varargs elimination
3. Reactor sort O(N=C2=B2 log N) =E2=86=92 O(N log N), model building pipel=
ine
allocation reduction
4. Install/Deploy plugin O(N=C2=B2) reactor scans =E2=86=92 O(N) with cachi=
ng

All PRs are green and ready for review.

Regards,
Guillaume

--000000000000a572520658234c5c--