apupier opened a new pull request, #30198:
URL: https://github.com/apache/camel/pull/30198

   JIRA: https://issues.apache.org/jira/browse/CAMEL-27029
   
   ## Motivation
   
   `camel-launcher` is a leaf module on the critical path of the build: it 
cannot start before `camel-jbang-core` and all the pre-installed plugins are 
built. Its tests make up most of its build time (about 30s of the 43s of a full 
`mvn install` on 22 cores), and almost all of that is spent spawning processes 
(`java`, `sh`, `bash`), not running launcher code.
   
   ## Changes (test-only, 2 files)
   
   **`WebsiteManifestGeneratorTest`**
   - Every test launched the generator as a source file (`java 
WebsiteManifestGenerator.java`), which recompiles it in memory on each call: 
about 0.45s wall and 1.8s CPU per launch, 51 launches in the class.
   - The generator is now compiled once in a `@BeforeAll` (JDK in-process 
compiler) and launched with `-cp` and `-XX:TieredStopAtLevel=1` (about 0.03s 
per launch).
   - `stableWritesVersionAndLatestManifests` keeps the source-file launch, 
since that is how `camel-package.sh` runs the generator.
   - The class goes from 23.7s to 3.4s when run alone.
   
   **`WebsiteInstallTest.PosixShell`**
   - The 86 tests ran one after the other. They already share no state: each 
has its own `@TempDir`, `HOME` and HTTPS server on an ephemeral port, the TLS 
certificate is created once behind a lock, and no system property is set.
   - The nested class is now `@Execution(ExecutionMode.CONCURRENT)`, on top of 
the class-level parallelism the module already enables 
(`camel.surefire.parallel=true`).
   - 17s to 3s on 22 cores, 15.8s to 5.1s on 4 cores. 4 runs per core count 
with `-Dsurefire.rerunFailingTestsCount=0`, no failure.
   - The Windows PowerShell nested class is left as is: its `@AfterEach` 
restores the user PATH in the registry, which is shared state, and I could not 
run it on Linux.
   
   ## Measurements
   
   `mvn install -o` on `camel-launcher`, CPUs selected with `taskset`, no 
`camel` on the `PATH`, 418 tests (47 skipped on Linux) passing in every run:
   
   | Cores | Before | After |
   |---|---|---|
   | 22 | 38.3-40.7s | ~22s |
   | 4 | 53.7-54.1s | ~26s |
   
   The "after" figures are a single run per core count. Gains on CI will 
differ, as the module competes for CPU with others.
   
   ## Not changed on purpose
   
   - `SelfUpdateIntegrationTest` sets the JVM-global `user.home` and 
`camel.launcher.jar` system properties.
   - `PackagePlanTest` shares fixed files under `target/` that its `@AfterEach` 
deletes.
   
   Neither can run its methods concurrently without a rework (the remaining ~9s 
and ~6s on 22 cores), so they are left for a possible follow-up.
   
   ## Notes for reviewers
   
   - `ToolProvider.getSystemJavaCompiler()` needs a JDK at test time, which the 
Camel build already requires.
   - `PackageNativeValidationTest` looked slow locally only because 
`camel-validate.sh` runs the host's real `camel` when one is on the `PATH` 
(about 1.4s per call). It takes 0.6s without one, so it is not touched here.
   - No upgrade guide or generated file is affected. `mvn formatter:format 
impsort:sort` produces no further diff.
   
   ---
   _Claude Code is not involved; this PR was prepared by IBM Bob 2.2.1 (AI) on 
behalf of @apupier._
   


-- 
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]

Reply via email to