Graal: Graal JIT: Number of optimizations vs C2

Created on 14 Dec 2018  路  6Comments  路  Source: oracle/graal

Another quick question... roughly how many optimizations are implemented in the Graal JIT vs C2? Is it in the same ballpark? I understand that these compilers are not identical, so results will definitely vary. I'm mainly asking whether some major tricks that C2 has up its sleeves are unimplemented in Graal.

As I recall, people have also reported cases where Graal already outperforms C2.

Most helpful comment

I'm an advocate of Graal for a very long time now and it provides us with much better performance but it's important to note that Graal CE is missing loop-vectorization. But it's pretty much the only (big) thing that C2 has and Graal doesn't.

All 6 comments

Graal Community Edition (CE) is comparable to C2. Graal Enterprise Edition (as found in GraalVM EE on OTN) includes more sophisticated optimisations such as better partial escape analysis and an advanced inlining algorithm that shows noticeable improvements on modern workloads. For further information, check out this page.

I'm an advocate of Graal for a very long time now and it provides us with much better performance but it's important to note that Graal CE is missing loop-vectorization. But it's pretty much the only (big) thing that C2 has and Graal doesn't.

provides us with much better performance

How much more (just very roughly)? Does this also hold for Graal CE?

One should evaluate it on their code and their workloads. It heavily depends on the tech stack, abstractions used, etc. Here's for example an article about some benchmarks on the Stream API performance, or Scala code.

Internally, we run a large body of benchmarks, but reporting a single number (or even a few) is at best somewhat useless and at worst can be misleading. Like an average temperature in a hospital.

CE is in general on par with HotSpot, but more sensitive to the workload at hands. Twitter for example is using the open source version of the Graal compiler for their Scala microservices and reports improving throughtput and having noticeably fewer GC cycles. But one should definitely evaluate the performance impact for their codebase. EE is faster than CE.

Compiling Scala benchmark:
Scala benchmark

That's all I wanted... just a teaser that shows that upgrading might be worth it (the brain just works like that). I totally agree that the world is more complex than a few numbers. Thanks.

What @shelajev said. And this: https://youtu.be/PtgKmzgIh4c?t=1338

Was this page helpful?
0 / 5 - 0 ratings