First impressions about Graal VM
blog.frankel.ch
blog.frankel.ch
Regarding the example benchmark: It is mainly testing the performance of the String::compareToIgnoreCase method, which has a very different implementation in Java 9 and beyond compared to Java 8 (due to the "compact strings" feature). The method generally is not very complex, so it is not ideal for compiler comparisons.
...
The largest workload tested on Graal is currently the production use of Graal at Twitter where they get somewhere between 12% (CE) and 24% (EE) improvement.
I also looked into what else Graal is capable of and it's cool to run C programs or even curl on top of it. Sadly I wished the NODE.JS integration would've been better. I wished I could run angular universal on top of Graal within Play! so that Play! would've been able todo the same thing than .net core with it's angular integration (just without running node!). However Graal can only run "pure" JavaScript (https://github.com/graalvm/graaljs/issues/2).
(native-image does not work with Scala 2.12 (Scala 2.12 emit's indy which does not work with SubstrateVM) or even Play! on 2.11 did not work)
The Graal Python prints a warning when you start it that it is a very early state.
So I tried Ruby, and I was able to do a simple print, and the startup time for Graal vs Ruby was about the same.
Looks like Java is the real target right now. A very interesting project, looking forward to seeing where it goes.
And it's actually more complicated than that:
Of course GraalVM can compile JavaScript to native code, it just only does it at runtime, as a JIT.
GraalVM can run JavaScript during ahead-of-time compilation, so you can run your JavaScript program so far, and then compile it at that point with all its state compiled into the image. We use this to do things like pre-initialise libraries ahead-of-time so when you start to run everything is set up and ready to go.
Finally, the mathematical trick we use to compile JavaScript to native code at runtime, which is called partial evaluation, or more formally, the First Futamura Projection, has a theoretical more advanced variant called the Second Futamura Projection, which could be implemented in GraalVM to, indeed, compile JavaScript ahead-of-time to native code. But implementing this practically is an open problem and not really our goal.
The Futamura Projections can be explained in about three lines and is not at all a complex concept to wrap your head around.
Casually inserting these terms in a forum where most people likely haven't had much exposure to partial evaluation terminology makes it sound like you want to either forcefully polularize these terms or make yourself sound more important.
...not saying you intended either.
fwiw https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
If you are interested in very short running programs, then these benchmarks can be interesting to look at.
If you are more interested in long running programs, like web servers, then I don't think you'll find many professional virtual machine implementors who will agree that this is a valid way to benchmark things.
But we probably also have some optimisation bugs to work out still. There's even some errors in the logs of those.
Let's be clear that we're talking about minutes not milliseconds.
What's "quick" and "long running" in CPU secs on some machine?
What language implementation are we using as a baseline when we say "quick" and "long running"?
Otherwise someone might well say that 8 minutes with TruffleRuby is "long running" and CRuby 2.5 makes "some pretty incredible improvement" over that :-)
Also: Try "print('hello world')". It's targeting python3
We have this problem of one standard binary interface, the C ABI. It is the only standard binary interface. If I want to write a library that can be used by any language, I have to export a C interface.
There have been solutions, such as Corba and COM, but cross language support never really took off. We end up with ports of libraries. There are tons of libraries ported between C++, Java, C#, etc. All because they live in their own world. Using a C++ library in C# requires exporting a C interface and then hand wrapping the library with pinvoke.
Before I read about GraalVM I was under the impression that WebAssembly would accomplish this.
That's something, but what about a set of mutually tail-recursive functions? Of course one can always use a trampoline, but then you have to pay the cost of consing thunks. It would still be worthwhile to have true tail-call instructions in the bytecode.
https://www.researchgate.net/profile/Chris_Seaton/publicatio...
We aren't looking to modify Java, so we aren't the people to ask for a tail-call instruction in the bytecode.
We build entire JavaScript, Ruby, and Python interpreters using the native code generator, so we do know it works for non-trivial applications and libraries. I've also used it to do things like compile the third-party Apache SIS geospatial library for use from a native application without issue.
The author's tried just one benchmark - there are many other benchmarks and use-cases. Twitter report it's around 11% faster for their real and extremely large codebase, so we also know for other people it's significantly faster.
That must be a nice benefit of being part of a large corporation is being somewhat more delineated from the hype cycle of innovations like this.
"Yes ma'am I understand your router keeps rebooting, but I made it so that you can flush your toilet now."
No, microbenchmarks never speak for themselves.
Even just preventing a powerful compiler like Graal from optimising away your microbenchmark is going to be a challenge - Graal currently defeats the state-of-the-art JMH for example, and most people wouldn't even going as far as to use JMH.
I have many examples of microbenchmarks that Graal (when being used as a JIT for Ruby in my case) will optimise away that people will find very surprising.
I wrote a blog post in response to someone's attempt to investigate different implementations of a small function through a sequence of microbenchmarks without asking why. I go into detail about a bunch of ways they ended up being wrong because they thought the numbers spoke for themselves. This only gets worse when talking about JITs, since their behaviour is even less local.
https://medium.com/@veedrac/learning-the-value-of-good-bench...