slachiewicz opened a new issue, #13404: URL: https://github.com/apache/maven/issues/13404
### Affected version 4.0.0-rc-7 ### Bug description Every Maven 4 invocation starts about 1 s slower than Maven 3.9, almost all of it before the first log line. Tools that start Maven many times pay it on every run: the integration tests of mojohaus/versions make about 240 Maven invocations through maven-invoker-plugin, and their IT phase on GitHub Actions takes 23% to 55% longer with 4.0.0-rc-7 than with 3.10.0. #12667 and #2481 covered throughput on large reactors; this report is about the fixed cost per invocation, which a one-module build or an IT run sees in full. **Local measurements.** Linux aarch64, OpenJDK 21.0.12, 2 vCPUs, `mvn -o -B validate` on a POM with only coordinates and `<packaging>pom</packaging>`, the two versions run alternately, 8 runs each, medians: | Scenario | 3.9.16 | 4.0.0-rc-7 | |---|---|---| | `validate`, empty POM | 1.97 s | 3.12 s | | Time to the first log line | about 1.85 s | about 2.83 s | | From the first log line to the end | about 0.10 s | about 0.22 s | | Classes loaded (`-Xlog:class+load`) | 3,936 | 6,318 | So the cost is in bootstrap, before the build starts, and goes with 60% more classes loaded. The `--enable-native-access` probe in `bin/mvn` is not the cause; 3.9.16 runs it too. With `.mvn/jvm.config` present, 4.0.0-rc-7 takes another 1 s (4.11 s against 1.95 s for 3.9.16). That is the source-launched `JvmConfigParser.java` from #11365, which estimated the cost at ~200 ms for `mvn -v`. On this machine it is about five times that. **CI.** IT phase of mojohaus/versions, medians of five GitHub Actions runs per job, `invoker.parallelThreads=0.75C`, no `jvm.config`: | Job | 3.10.0 | 4.0.0-rc-7 | |---|---|---| | macOS, JDK 25 | 3.8 min | 5.9 min | | Ubuntu, JDK 21 | 4.0 min | 5.5 min | | Ubuntu, JDK 25 | 4.1 min | 5.1 min | | Windows, JDK 25 | 7.0 min | 8.6 min | **Reproduce:** ```sh mkdir -p /tmp/m4bench/.mvn && cd /tmp/m4bench printf '<project xmlns="http://maven.apache.org/POM/4.0.0"><modelVersion>4.0.0</modelVersion><groupId>localhost</groupId><artifactId>empty</artifactId><version>1.0</version><packaging>pom</packaging></project>\n' > pom.xml for i in 1 2 3 4 5; do /usr/bin/time -f "3.9.16 %e s" /path/to/apache-maven-3.9.16/bin/mvn -o -q validate /usr/bin/time -f "4.0.0-rc-7 %e s" /path/to/apache-maven-4.0.0-rc-7/bin/mvn -o -q validate done echo "-Xmx512m" > .mvn/jvm.config # then repeat the loop ``` I have not measured Windows (`mvn.cmd`) or JDK 17 and 25 locally, and I have not profiled which components load the extra classes. -- 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]
