223 points · by ksec · 9y ago · 41 comments
"JRuby+Truffle started as my internship project at Oracle Labs in early 2013. It is an implementation of the Ruby programming language on the JVM, using the Graal dynamic compiler and the Truffle AST interpreter framework. JRuby+Truffle can achieve peak performance well beyond that possible in JRuby at the same time as being a significantly simpler system. In early 2014 it was open sourced and integrated into JRuby."
via http://chrisseaton.com/rubytruffle/
I've used JRuby for a while, but I hadn't heard of Truffle
The JVM is an exciting place to be right now.
That's blazingly fast! The missing part now is C extension support and they seem confident to be able to deliver this.
Color me impressed.
Wasn't part of truffle's point and advantage that it would interpret and JIT C code alongside Ruby code and optimise across the boundary? Is the missing part just the declaration of the MRI API on the C-side, or is it pre-compiled (and thus not interpretable) C extensions?
We work on the C source code (actually the LLVM bitcode) rather than compiled C extensions, yes.
The jruby ecosystem is extremely mature and production ready. For example, database connectors exist which are pure java rather than based on c extensions. They may be better as well. Same goes for ssl (https://github.com/jruby/jruby-openssl/blob/master/README.md) and xml parsing (https://github.com/YorickPeterse/oga/blob/master/README.md)
Also goes for all the json parsing, etc stuff which seems to need c extensions. Lots of systems stuff is perfectly workable using jruby (https://github.com/minimagick/minimagick/blob/master/README....)
This would be a different story if you were doing jython fof example - python does not have a viable java based ecosystem.
If I were you, i would NOT focus on c extensions and instead work on other stuff (like startup speed)
Ah OK, I guess I remember the 2015 news and thought it a "done deal" rather than a POC/WIP. Thanks.
Compilers are cool.
Is there an HN reader app that does it? or just HN jargon?
The Graal/Truffle/Sulong stack is pretty amazing, being able optimize through the ruby/C boundary is crazy. Really looking forward to see what comes out of that work this year and beyond.
Does the ability to use Java libraries with TruffleRuby go away with SubstrateVM though?
I'm thinking of Shenandoah specifically.
I understand they depend on inserting barriers with JVMCI, so I'm hopeful for compatibility. How is SubstrateVM build? It is made out of using the OpenJDK code base in a specific manner?
I really like the idea of TruffleRuby becoming its own super fast Ruby implementation unhindered by the need to provide the same feature set as JRuby.
I think that the best practice for C extensions when used for performance is that Gems have both a pure Ruby reference implementation and a C extension. This means all implementations can run them and more people can read the code. OilyPNG and PSD Native do this and it's been extremely helpful to my research.
C extensions, even when run in our interpreter, tend to run faster than Ruby code because C has simpler semantics and needs fewer guards (checks) when running code.
I haven't done a careful comparison of C extension performance compared to Ruby performance when both are running on Graal. I should do that.
Pure Java is pretty fast, and an existing library has the advantage of not just already being around, but probably being battle-tested.
30 Comments which means HN as a community has lost interest in Ruby.
A signal that Ruby is dying? ( Or in maintenance mode, or not growing, which ever you may prefer to word it ) Only Last week someone replied to me on HN that their areas dont have any Open Jobs for Ruby Devs.