-
Hello, I started a discussion at remkop/picocli#1909, because picocli is a huge single source file, and so a single module, and I wanted to better understand if this has an impact on the generated native image size by graalvm. Here are a few questions I have:
In the end, I'm wondering if there are a set of best practices that one could follow to help the static analysis of graalvm to generated smaller native image sizes. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @Jiehong, how the code is organized shouldn't make much difference on analysis/compilation performance. From the point of view of the analysis what matters is if it can prove that some execution paths can never be taken, e.g., if it can prove that a variable |
Beta Was this translation helpful? Give feedback.
Hi @Jiehong, how the code is organized shouldn't make much difference on analysis/compilation performance. From the point of view of the analysis what matters is if it can prove that some execution paths can never be taken, e.g., if it can prove that a variable
x
always has typeA
then theelse
branch of aif(x instanceof A)
can be eliminated. The analysis consumes the code one method at a time, regardless of how the code is divided in files, but organizing the code in type hierarchies may give more type hints and enable more aggressive optimizations. Generated code doesn't hurt the analysis as long as the generated code is not unnecessarily large when compared to the manually written equ…