TruffleRuby on the Substrate VM
nirvdrum.com
nirvdrum.com
Essentially, you can only get good startup times with TruffleRuby for testing. If you want to use TruffleRuby in production, you can't use the SVM version.
Prior to joining Oracle Labs, I ran a company that went through TechStars (Boston, 2010). We started with Ruby to get the MVP out. I would even say overall it was architected fairly well. But as we started growing, we hit performance issues that we just didn't have with a smaller customer base. As a bootstrapped company trying to grow, putting everything on hold to rewrite subsystems wasn't a terribly appealing option. We finally decided that it was a necessary evil and were going to move from MRI to JRuby, at which point we'd start replacing pieces with Java. As it turns out, JRuby ended up meeting our performance needs and we didn't have to rewrite anything (modulo code changes needed to run on JRuby). I ended up winding that company down for a variety of other reasons, but I'm happy I didn't become another case study in code rewrites.
By far, one of the most common complaints we hear is the start-up time is too slow. The split development model you've describted works for some, but becomes problematic when you want to use extensions specific to one runtime or another. Additionally, a lot of people don't want to run completely different language implementations in development and production.
So, the idea here is to give you a choice. You get to keep the same language runtime but get to choose the VM you want to run it on based on what your current context demands.
Tests seem a really cold start scenario, even if only a bit of code changes among test runs. Is it possible to save (I don't know what, the internal state of the VM?) for the unchanged parts among runs? Would that even work?
With the SVM, we're now at 1s (MRI) vs 9s (TruffleRuby/SVM). Previously, we were at 1s (MRI) vs 68s (TruffleRuby/JVM). There's a lot of ways to look at that data. You could say TruffleRuby/SVM took 9 times as long as MRI and that rules it out. Or you could say it took 8s longer and that's acceptable for my entire test suite, especially if I don't have to juggle multiple versions of Ruby. I really can't say -- that's for each team to decide on their own. But, we're looking to make the decision easier by further reducing that run time.
It could be possible to save the state of the parsed AST and embed that in the binary. It's actually what we do for the core library to help with start-up time. I'm not sure you'd really want to do that for individual codebases though. You would need to rebuild the static binary every time your code changes, eliminating a lot of the benefit of using a dynamic language is the first place. It would be far better if we just make TruffleRuby and the SVM faster, which we're working on.
Of course it doesn't clarify the licensing. But it seems like the bulk of basically all of Graal and Truffle are under the GPL and I do believe that with JVMCI, etc, making it into JDK 9 -- it seems like a pretty good bet all this will eventually be openly available. So I'm hoping for the same to be true of SubstrateVM, though I think it's in a slightly different place than Graal (Graal/Truffle are really just .jar libraries you put in the Classpath of your JVMCI-enabled JDK; they do not fork the JDK. But Substrate is clearly something else entirely, since it 'shrink wraps' your code with the JVM itself in a way).
I actually just started playing with Graal yesterday, so I'm looking forward to seeing Substrate being released.
Just to be clear: when you refer to the 'compiled binary', what binary are you referring to exactly? Is this the 'aot-image' tool inside the Graal OTN builds I was looking at? It was not clear to me if that was actually the Substrate tool or not, because the documentation is very vague[1] -- can any Graal-based language use that tool to test better startup times, etc?
Clearly if SVM is going to remain closed source, I'll have to continue to mostly ignore it (as I've done since I followed Graal), but it would be at least nice to see it "In Action" and what it does to the warm-up time, with my own eyes...
[1] http://www.oracle.com/technetwork/oracle-labs/program-langua...
Out of the box, the aot-image script has support for building Graal.js and TruffleRuby images/binaries, but you could modify the script to build whatever Truffle language you'd like. This is just our first release of the SVM and those are the two languages we've tested. As the SVM is fairly young and under active development, it's possible you'll encounter missing functionality. But we do have at least one community member on the graal-dev [1] mailing list trying it out.
I can't say whether the SVM will remain closed or not. I really don't know. There just currently aren't any plans to open it.
> I can't say whether the SVM will remain closed or not. I really don't know. There just currently aren't any plans to open it.
I'll keep my fingers crossed, then! SVM is honestly one of the most exciting components. So if I try it and I have any problems, I'll definitely let graal-dev know.
Then there are no reasons to expect it to be open, as long as it's commercially viable to sell it. This is Oracle we're talking about. Not a company known for its love for F/OSS.
It'd be a real shame if Oracle couldn't see the benefits of open-sourcing SVM. New companies are far less likely to base their tech stack on closed source components when more mature open-source competitors exist, there's too much risk involved.
it looks more speedy than ruby, but also is eating a lot of memory, and for some benchmarks is not that fast :)
Will be interesting with substrate vm if the results or memory are the same.
The memory use does seem excessive though. Perhaps a little too much code bloating due to the polymorphic inline caches?