Claus Ibsen created CAMEL-26428:
-----------------------------------

             Summary: camel-jbang - The CLI creates only the command that the 
command line runs
                 Key: CAMEL-26428
                 URL: https://issues.apache.org/jira/browse/CAMEL-26428
             Project: Camel
          Issue Type: Improvement
          Components: camel-jbang
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 4.24.0


The CLI creates all its commands (143 in camel-jbang-core, plus the commands of 
the plugins embedded in the launcher) on every run, also when the command line 
runs one of them, such as {{camel version}} or {{camel ps}}. Creating them 
loads their classes and builds the picocli model of each.

Measured on main (JDK 25), with CAMEL-26427: the model of the commands is about 
490 ms of a {{camel version}} of 566 ms (about 230 ms loading and creating the 
command classes, about 115 ms the picocli model, about 150 ms the commands of 
the embedded plugins, mostly the monitor of the TUI). Creating only the 
commands that run takes a few milliseconds.

The CLI should create only the command that the command line names, and all 
commands for the help, a command it does not know (a plugin, or a typo), and 
the commands that use the other commands or the plugins (shell, completion, 
run, export, cmd).

Found while measuring the startup for CAMEL-23810.

_Claude Code on behalf of davsclaus (Claus Ibsen)_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to