GraalVM boosts Java performance with Truffle framework

Java on Truffle in GraalVM 21 brings Java up to snuff with Python, Ruby, and JavaScript on the multi-language virtual machine.

GraalVM boosts Java performance with Truffle framework
Peter Griffin (CC0)

GraalVM, an Oracle Labs project providing a multi-language virtual machine, has added experimental support for Java on the Truffle framework, which derives high-performance code from interpreters and allows for efficient running of languages. The move elevates Java to the level of other languages on GraalVM and boosts Java performance.

Java on Truffle is introduced in GraalVM 21, which was published on January 19. GraalVM 21 has an installable component, called Espresso, that makes it possible to run Java code via a Java bytecode interpreter implemented with the Truffle framework. In addition to the bytecode interpreter, Java on Truffle provides other core components of a Java virtual machine including a single pass .class file parser, a simple object model, and a Java Native Interface (JNI) implementation. Java 8 and Java 11 are supported.

Thus in GraalVM 21 Java can be executed by the same principles as other languages the GraalVM supports, such as Python, Ruby, and JavaScript. However, current performance of Java on Truffle is not representative of what it will be in the near future. Performance is expected to increase rapidly in upcoming GraalVM 21.x releases.

Prior to version 21, GraalVM ran Java via the HotSpot VM with the GraalVM JIT compiler or via compilation to a native executable via GraalVM Native Image.

GraalVM 21 Community and Enterprise editions can be downloaded from Other new capabilities in GraalVM 21 include:

  • Added Java serialization support for Native Image binaries.
  • For JavaScript, the Node.js distribution has been updated to version 12.20.1. Also ECMAScript features enabled by default include class fields, Promise.any, String.prototype.replaceAll, and Logical Assignment Operators.
  • The Ruby implementation now targets Ruby 2.7.2.
  • For Python, the jarray module has been added for compatibility with Jython, a Java implementation of Python.
  • For the LLVM bitcode runtime, AST (abstract syntax tree) sharing has been improved and support introduced for auxiliary engine caching.
  • The GraalWasm interpreter for WebAssembly gains better peak performance and faster warmup.
  • As part of the GraalVM introduction, the GraalVM Extension Pack for Visual Studio Code has been introduced as a technology preview. It is available in the Visual Studio Code Marketplace.

Copyright © 2021 IDG Communications, Inc.