Replies: 2 comments 1 reply
-
There is an issue on quarkus repo about options for making picocli do it's scanning during build rather than at runtime. Maybe if we could contribute to that work then moving to quarkus would be more interesting. Advantages of quarkus is things would more easily compile to native. Downside is our dependnencies might be quite bigger - but need to test that. |
Beta Was this translation helpful? Give feedback.
-
Copying some "data" from old chats so we have some numbers at least:
|
Beta Was this translation helpful? Give feedback.
-
From some extensive but very informal testing I did some time ago I found that the biggest part of Jbang's startup time is spent on initializing Picocli. So I've been thinking about ways to make things faster. Let's see if together we can come up with a solution.
These were my ideas:
For each of these options we have some pros and cons (and some cases only cons):
Compile to native
We could use GraalVM to compile Jbang to native code. We could distribute the binaries as part of the distribution .zip/.tgz and use the startup scripts to determine what we want to execute (binaries for the correct platform are available, use them, if not fall back to using the .jar).
The pro is that this probably results in the fastest code. The con is that we'd need to come up with a way to make the build integrations work. This could probably be done by falling back to the Java code when we need to build anything. If we made a special entry point that didn't use Picocli just for that purpose we could keep that functionality without giving up too much of the speed boost that native code would give us. Another con is that the distribution process would get more complicated (building native binaries etc).
Use Quarkus
This is the part I know least about. So I can't give a good analysis about pros and cons. Perhaps you can fill this in @maxandersen ?
Use Picocli API
The reason for this option is because I'm assuming that the slowness in setting up Picocli is because of all the annotations and introspection that's going on. Using the API would avoid all that.
The most obvious con is that the API is much harder to use than the annotations.
So one idea I had to mitigate that complexity is to keep using the annotations and create some kind of code generator that reads those annotations once and then turns that into code that uses the API.
The pro is that we'd get rid of the slowness while keeping the ease of maintenance that annotations give us. The big con of course is that creating that code generator is a very complex job in itself. (But it might be something the upstream would be willing to adopt once it works).
Use something else than Picocli
Not knowing any good alternatives this is basically just cons. Even if there is an alternative that isn't slow, switching to something else is a huge job.
Beta Was this translation helpful? Give feedback.
All reactions