Skip to content
Search

GraalVM

lastmod 2021-07-23created 2019-11-025 edits

GraalVM is a universal virtual machine for running applications written in JavaScript, Python, Ruby, R, JVM-based languages like Java, Scala, Groovy, Kotlin, Clojure, and LLVM-based languages such as C and C++.

See also

How GraalVM accelerates Spark workloads

Some of the optimizations that contributed most to Spark's performance improvement are as follows.

Polymorphic inlining
Traditional inlining works only when the compiler can determine the exact method that a method call targets.
GraalVM enables inlining beyond this point by collecting additional profiling information that allows even abstract methods to be inlined.
Partial escape analysis
The idea of partial escape analysis is to perform scalar replacement on branches where the object does not escape, eliminating unnecessary object allocations, and to make sure the object exists on the heap on branches where it must escape.
This reduces both the application's memory footprint and the CPU load caused by GC.
This optimization matters even more in data-heavy applications such as Spark.
In particular, as observed at Facebook, GraalVM reduced CPU consumption by up to 5x in methods such as java/lang/Double.valueOf.
GraalVM's advanced speculative optimizations
They use dynamic runtime feedback to generate faster machine code.
By speculating that certain parts of the program will not run during execution, the GraalVM compiler can specialize the code and make it more efficient.
For Spark, this optimization works especially well by eliminating branches (e.g. long if-then-else chains), simplifying control flow, reducing the amount of dynamic checks in loop bodies, and establishing aliasing constraints that enable further optimizations.

Favorite site

author Zer0 sitemap