IntelliJ IntelliJ IDEA Internals Java

Metal for IntelliJ Platform

As you may already know, Apple deprecated the OpenGL rendering library in macOS Mojave and provided the Metal framework as a replacement. Metal better reflects the shift in CPU/GPU performance that has happened over the last 20 years. So, with proper implementation, apps that are based on Metal perform better and consume less energy than the old OpenGL ones.

What does this mean for our products? Our Java-based IDEs use the Swing UI toolkit, which renders using the Java 2D API. Internally, Java 2D uses platform APIs to present the result of rendering. Starting with JDK7, the rendering subsystem of macOS Java was reimplemented using the OpenGL pipeline, originally designed for the Linux platform. So, at the moment Java 2D on macOS heavily depends on OpenGL. That is not good for many reasons, one of which is the lack of support from Apple for this deprecated technology. Moreover, at some point it could be removed completely from later OS releases.

Taking all of this into account, we’ve started a joint initiative with the Oracle desktop team to implement JEP 382Project Lanai. Our goal is to implement the Java 2D API on top of the Metal framework. We’ve already achieved some progress, and the performance is on par with the OpenGL pipeline in many scenarios. There are still some quality and stability issues, but we’re on the right track to deliver the new pipeline in one of the upcoming releases of OpenJDK. If you want to test it out already, here is our latest EA build to try. (Beware, the preview builds may not be reliable, may not work as intended, and may contain errors. Any use of the EA product is at your own risk).

image description