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

   [CAMEL-25720](https://issues.apache.org/jira/browse/CAMEL-25720): **load the 
kamelet catalog and the Quarkus BOM versions once per JVM.**
   
   ### The problem
   `ExportTest` takes 95 seconds, the longest test class of camel-jbang-core. A 
profile of it (JFR) shows two hot spots:
   - `ExportBaseCommand.resolveDependencies` calls 
`KameletCatalogHelper.findKameletNames` on every export, which builds a new 
`KameletsCatalog`, and the catalog scans the whole classpath with ClassGraph: 
about 44% of the CPU samples.
   - `QuarkusHelper` reads every Quarkus platform BOM of the registry with DOM 
and XPath, to find the Camel version of the platform: about 25%. The mapping 
that it keeps on disk is not used for a snapshot, or a version that does not 
match exactly.
   
   The same happens in a JVM that runs several commands: camel shell, the TUI, 
the MCP server.
   
   ### The change
   - `KameletCatalogHelper.loadKamelets` keeps the kamelets of a released 
catalog for the JVM, by version and repositories, as a map that cannot be 
changed (the callers only read it). A snapshot catalog is loaded every time.
   - `QuarkusHelper` keeps the managed versions that it read from a released 
platform BOM for the JVM, by BOM and artifact. A snapshot BOM is read every 
time.
   
   ### Result
   `ExportTest` runs in 44 seconds instead of 95. The tests of the module take 
334 seconds instead of 399 as they run today (a JVM per test class), and #28004 
runs them in parallel forks.
   
   ### Tests
   - `KameletCatalogHelperTest`: a released catalog is loaded once (the same 
map), and the map cannot be changed.
   - `QuarkusHelperTest.releasedPlatformBomIsReadOnce`: after one lookup, the 
BOMs are not resolved again.
   
   Both fail without the change. `mvn verify` of camel-jbang-core: all pass.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01DDRLJAyf8cDXSg8iX785My
   


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