The Remarkable Dad

My husband is a remarkable man. This, after all, is why I married him. His warmth, kindness, sense of humor, and laid back attitude was obvious to me from the beginning. He is a high school special…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Native javac built with GraalVM

Updated 2020–02–09: documented changes required for GraalVM 19.3.1 (benchmark data remains that for GraalVM 1.0.0-rc16)

Updated 2020–02–09: the following instructions are for the Java 8 variant of GraalVM only.

You can’t compile javac directly with native-image as javac needs the system properties that point to where it can find the JAR files that make up the JDK. The following class adds the missing properties:

Updated 2020–02–09: native-image must now be installed separately by running: gu install native-image

The following script will build the native executable:

Note: to squeeze a bit more performance, and minimize binary size, I added two additional command-line flags when building javac-native for the benchmark. -H:-MultiThreaded this removes unused support for multi-threading. Updated 2020–02–09: -H:-MultiThreaded results in a segmentation fault error and should not be used. -H:+NativeArchitecture this compiles using the features of the local CPU.

Since few people use javac directly let’s see what effect this has on Maven build times:

The native javac executable reduced build time by between 5% to 16%.

Given the unit tests consume most of the build time lets see what the results look like when we skip the test execution:

Without the tests, the native javac executable reduced build times by between 12% to 39%.

As you can see the native javac executable significantly improves build times across the board.

The adventurous of you are probably wondering if you can use this to make your existing local or CI builds faster. I think executables built with GraalVM native-image have the potential to change the way we build Java applications in a much more fundamental way.

Executables built with GraalVM native-image open the door to making Java build tools simpler and faster. Whether such a tool could match the speed of a warmed up Gradle build server is a question that would need answering, but it’d clearly be faster than Maven.

Add a comment

Related posts:

Helicopters and Drones

Go to any park nowadays and you will likely see drones, or unmanned aircraft systems (UAS). It all seems so normal. Just 10 years ago, the skies were largely free of UAS. Now, however, the surging…

How to Create A Server With Express And Node.js

The runtime is intended for use outside of a browser context (i.e. running directly on a computer or server OS). As such, the environment omits browser-specific JavaScript APIs and adds support for…

LIVE Talk with Jana Klauke to Know More About Tattoo Policy in Workplaces

More and more Americans are having a tattoo on their bodies as time goes on. However, many people are arguing that they are facing tattoo discrimination in workplaces or when they try to get hired…