Skip to content

Casual Machine Performance Test

Published: at 08:00 AM

Java Performance Showdown: JDK vs. GraalVM Native Image Across the Silicon Spectrum (Spoiler: Apple’s M-Series Shines)

Ever wondered how your machine really stacks up when it comes to Java performance? We’re not talking about hitting that absolute peak, hyper-optimized, once-in-a-blue-moon benchmark. Nah, this is about real-world, “let’s run it a couple of times and see what’s what” kind of performance. We’re looking for those ballpark differences that tell a story about the raw power – or lack thereof – under the hood.

The goal is simple: get a feel for the uplift between different systems, with a special curiosity about how Apple’s M-series MacBooks are changing the game. We’re pitting standard JDK compilation and runtime against the lean, mean, ahead-of-time compiled GraalVM Native Image.

The Ground Rules

To keep things fair and focused on pure CPU grunt, we made sure to rerun any initial Gradle runs. Why? Because nobody wants their benchmark tainted by Gradle downloading itself or pulling a mountain of dependencies. We’re interested in processing power, plain and simple.

These were the instructions given to some friends who had the machines required to flesh out this benchmark:

For this experiment, you’ll want your JAVA_HOME pointing to a GraalVM JDK.

The Test Bench Commands:

The Contenders & The Results:

Let’s dive into the numbers. We’ve got a diverse lineup, from old Intel MacBooks to modern M-series Machines, and even a couple of Linux and Windows machines thrown in for good measure.

SystemJDK Compile Time (ms)JDK Startup Time (s)Native Compile TimeNative Startup Time (ms)Spec NotesOS
2015 Macbook Pro30003.849436s (7m 16s)320MacOS
2020 Lemur Pro40008.052657s (10m 57s)938System76, i5 10210U 4c 40GBUbuntu Server 21.04
2019 Macbook Pro20003.786230s (3m 50s)4132.6GHz 6c i7MacOS
M1 Pro10002.071140s (2m 20s)207M1 Pro 8c 32GBMacOS
M2 Air10001.687205s (3m 25s)180M2 16GBMacOS
M2 ProN/AN/AN/AN/ACouldn’t get my hands on oneMacOS
M3 Pro6501.49079s (1m 19s)205M3 Pro 12c 36GB (6p,6e)MacOS
M3 Max6201.42966s (1m 6s)204M3 Max 16c 48GBMacOS
M4 Mac Mini6501.253125s (2m 5s)158M4 10c 32GB (4p,6e)MacOS
M4 Pro3331.30468s (1m 8s)189M4 Pro 14c 48GB (10p,4e)MacOS
ITX Computer10002.410186s (2m 46s)172Ryzen 5700g 8c 16t 32GBPop!_OS 22.04 LTS
Dell 556014603.465217s (3m 37s)277Intel i7 32GBWindows 11 Pro

Note: Data for the M2 Pro was not available.

Dissecting the Data: The Apple M-Series Uplift is Real

Let’s be frank, the numbers speak volumes, especially when we zoom in on the Apple silicon.

JDK Performance:

GraalVM Native Image Performance:

This is where things get really interesting due to the ahead-of-time compilation.

Comparing Across the M-Series Generations:

The M4 Pro shows a significant jump in JDK compilation over the M3 Pro. Native compilation and startup times are seeing smaller, but still present, gains with each M-series iteration, suggesting these were already highly optimized.

What About the Non-Apple Camp?

Drawing Conclusions: The Ballpark Figures

  1. Apple’s M-Series is a Game Changer for Java Devs: The performance uplift from Intel-based Macs to the M-series (M1, M2, M3, and now M4) is undeniable and significant across both standard JDK tasks and GraalVM Native Image compilation/startup. If you’re a Java developer on a Mac, the M-series offers a substantially better experience.
  2. Generational Gains in M-Series are Consistent: Each new M-chip generation (Pro and Max variants in particular) continues to offer noticeable improvements, especially in CPU-bound tasks like compilation. The M4 Pro’s JDK compile time is particularly impressive.
  3. GraalVM Native Image is Blazing Fast (Especially Startup): The startup times for native-compiled applications are in a different league compared to standard JDK startup. We’re talking milliseconds versus seconds. While native compilation takes longer, the runtime benefits can be huge for certain applications.
  4. M-Series Excels at Native Compilation Too: While the Ryzen 5700g showed strong native compilation, the higher-end M3 and M4 chips (Pro/Max) are leading the pack in our dataset, making the wait for a native binary significantly shorter.
  5. M-Series Air vs. Pro/Max: While the M2 Air is incredibly capable and often matches or beats older i7s and even the M1 Pro in some JDK tasks and native startup, the “Pro” and “Max” versions of the M-chips with more performance cores and potentially higher memory bandwidth show their strength in the more demanding native compilation tasks. The M4 Mac Mini with its 4 performance cores, however, shows that even the non-Pro/Max M4 chips are very potent.

The Bottom Line:

If you’re looking for a ballpark understanding, Apple’s M-series MacBooks, particularly the M3 and M4 generations, offer a stellar Java development experience. They provide substantial uplifts in both traditional JDK workflows and when diving into the world of GraalVM Native Images. While powerful desktop CPUs like the Ryzen 5700g can hold their own, especially in Linux environments, the efficiency and performance packed into Apple’s custom silicon for laptops (and now the Mac Mini) are hard to ignore.

The evolution is clear, and the speed is real. Happy coding!


Next Post
Spring Version Compatibility Cheatsheet