GraalVM — What is it?

Igor Kengi Shiohara
2 min readDec 10, 2019

--

What is GraalVM

Basically GraalVM is a high-performance, polyglot, virtual machine for running programs in different languages. It supports JVM-based languages such as Java, Scala, and Kotlin and also JavaScript, Ruby, Python, and R. So it means that it can run programs faster and also compile and interpret other languages. It is released by Oracle.

Performance

The reason to use GraalVM is to gain performance. I run 2 examples in my machine collected on the official GraalVM website to see the difference with GraalVM and without GraalVM.

  1. This example counts the number of uppercase characters in the body of the text. To simulate a large load, the same sentence is processed 10 million times.

Results in my machine:

Without GraalVM:

And now with GraalVM (Enterprise Edition):

As you can see, it is almost 50% faster. I am using the Enterprise Edition for Java 8 (v19.3.0), which is faster than the community edition.

How Graal Compile keep up-to-date with all supported languages?

Because they created a framework called Truffle. It is a framework for implementing managed languages on top of GraalVM. It offers an API to describe an interpreter for your programming language. So he builds an interpreter that operates on the Abstract Syntax Trees (ASL).

It means that Truffle implements interpreters that can be executed on top of JVM, so you can implement your own language to run on GraalVM through Truffle Framework.

References:

GraalVM website: https://www.graalvm.org/docs/

Top 10 things you can do with GraalVM: https://medium.com/graalvm/graalvm-ten-things-12d9111f307d

Truffle Framework: https://github.com/oracle/graal/tree/master/truffle

--

--