Building native images
In this section, we will build a native image, using the Graal Native Image builder (native-image
).
Let's start by installing the Native Image builder.
native-image
can be installed using GraalVM Updater with the following command:
gu install native-image
The tool is directly installed in the /bin
folder of GRAALVM_HOME
.
Let's now create a native image of FibonacciCalculator
, from the Graal compiler configurations section in Chapter 4, Graal Just-In-Time Compiler.
To create a native image, compile the Java file and run native-image FibonacciCalculator –no-fallback -noserver
. The following screenshot shows the output after running the command:
Native Image compilation takes time, as it has to perform a lot of static code analysis to optimize the image that is generated. The following diagram shows the flow of ahead...