Introduction
A high level summary and commentry on the aforementioned Java 24 performance update video. Java is not just updating it's performance and usability in general but moving way faster year on year. The Java 25 is likely to be released somewhere in 2025.
This video is of last year Devoxx but recently posted on Java Youtube channel and as a curios Java follower I found it very interesting, thus I decided to write about it on my blog. This video initially gives summary of Java projects, performance metrics, challenges faced in performance and then shared the recent and future performance improvements. If you don't want to get into initial summary and focus on recent performance improvements you can start from here.
Ongoing Java Projects
Speaker summarized the ongoing Java projects which are listed below,
- Amber : Small Java Features.
- Babylon: Extend reach of Java to SQL, ML Models and GPUs.
- Leyden: Improve start up time and reduce memory foot print.
- Lilliput: Reduce size of Java Object Header on 64 bit architecture.
- Loom: Lightweight concurrency.
- Panama: Integration between Java and system level programming languages.
- Valhalla: Augmenting java object model with value objects.
Metrics / Challenges / Tools
In this section speaker briefed about the different metrics one need to consider while checking for performance. Performance needs to be looked from wholestic view which must include usage of memory, CPU, threads, cache and power. Also, start up and warm up time needs to be considered while measuring the performance.
While talking about challenges speaker emphasized that we can not get accurate performance statistics on our laptops it's better to do it on dedicated server post warm up when application is ready to serve. That too one should not consider the result after very few runs, performance results needs to be collected after thousands of executions. Also, suggested to use System::nanoTime instead of System::currentTimeMillis for better accuracy while checking the performance.
Speaker mentioned about JMH (Java Microbenchmark Harness) which can be used to get micro level benchmarking using @Benchmark annotation. He further talks about the internal tools which Java team uses to check the benchmarks in different platforms which gives them an idea of how much the performance improve or degraded in respective platform.
Performance Improvements
Array store operation refers to process of writing values to the array index. Earlier the compiler was merging primitive stores such a way which was causing assertion failures and even incorrect optimizations.
Using Unsafe and BALE (Internal to JDK, jdk.internal.util.ByteArrayLittleEndian) were alternatives but both are not good considering Unsafe is something we should move away from and BALE may slow down things.
Summay
Apparently, there are other improvements also mentioned which will be the focus for upcoming months on top of these. These updates may look abstract and at first, may sound not making huge impact but by taking a close look it's moving in a direction of high optimization and efficiency.