
RTL MJIT – Register transfer language VM and JIT for Ruby - claudiug
https://github.com/vnmakarov/ruby/tree/rtl_mjit_branch#readme
======
wasd
According to Aaron Patterson (tenderlove / ruby and rails core committer) this
maybe Ruby 3x3 branch [1].

[1]:
[https://twitter.com/tenderlove/status/875467599290613760](https://twitter.com/tenderlove/status/875467599290613760)

~~~
appleflaxen
what does 3x3 mean?

~~~
ksec
Ruby 3.0 will be 3 times faster then 2.0

------
jitl
There are a whole host of alternative Ruby language implementations out there,
but I only see MRI and sometimes JRuby in the wild. The same goes for Python:
largely compatible alternative interpreters like PyPy have existed for years,
and often have better performance than the CPython standard interpreter.

Why don't we see more adoption of alternative runtimes? Why doest the
community push for the adoption of higher performing implementations as the
standard? Does anyone run a more esoteric interpreter for one of these
languages in production?

~~~
dom0
Specifically Python is just a very problematic language to re-implement, since
CPython has leaked internals literally everywhere. Last time I looked into
Pypy (to be fair, that's now a few years ago) that was the main pain point.

Implementing a sane subset of Python is not so difficult, because, well, d'uh,
it's sane. Implementing all the leaky details, the insane data model (slightly
less insane in Python 3), all the invasive interpreter APIs which are
frequently used by frameworks and extensions, is a whole different story. More
importantly, if you implement all those, there's not much to gain in
performance any more. Pypy has made tremendous progress there, but I'd expect
that it still suffers from this — bottom line is, there is no way to
efficiently implement what CPython does, and I'd be surprised if Pypy is
significantly faster than CPython in code that uses all this shit. I expect
Pypy produces a lot of gain as soon as code _doesn 't_ use that.

~~~
orf
Can you elaborate on what internals you've seen leaked?

~~~
dom0
Instead of typing a long list, I'll just refer you to this talk:
[https://www.youtube.com/watch?v=qCGofLIzX6g](https://www.youtube.com/watch?v=qCGofLIzX6g)

Some of that has been fixed / got make up applied to play pretend.

~~~
orf
Thank you!

------
ksec
I remember a talk / presentation from Chris Seaton, where he said something
like optimizing the static part of Ruby isn't hard. But it is the C Extension
/ Core Lib and Especially the Meta Programming nature of Ruby that makes it
near impossible for compiler to optimizes, especially the use case with Rails.

~~~
rurban
Just fix the VM then. tinyrb based on potion based on lua with classes is
~200x faster in method calls, and has a full dynamic MOP. Common Lisp ditto.
Traditional optimizations don't work when the base VM is poorly designed.

Always take advice from people of failed products with a grain of salt.

~~~
chrisseaton
> Just fix the VM then

No the point isn't that the VM is broken. The point is that the Ruby language
has semantics and is used in idioms that nobody knows how to optimise well
yet.

> tinyrb based on potion based on lua with classes is ~200x faster in method
> calls

tinyrb is interesting, but it just isn't the same semantics as Ruby:

[https://github.com/macournoyer/tinyrb#what-wont-be-in-
tinyrb...](https://github.com/macournoyer/tinyrb#what-wont-be-in-tinyrb-tiny-
patches-accepted)

tinyrb doesn't have a better VM - they're implementing a different programming
language with all the hard bits left out!

In my project we've been having to do new original research into how to
optimise Ruby - introducing concepts such as dispatch chains which haven't
been needed more because people don't try to push metaprogramming in most
language like they do in Ruby.

[http://stefan-marr.de/downloads/pldi15-marr-et-al-zero-
overh...](http://stefan-marr.de/downloads/pldi15-marr-et-al-zero-overhead-
metaprogramming.pdf)

~~~
rurban
Your interpretation of the tinyrb omissions is wrong. I'm the current
maintainer of potion which is the underlying VM for tinyrb. What is missing us
just sugar and peg parsing grammars for some trivial stuff. And then of course
the huge stdlib.

The simple potion/IO mop and ABI layout is far superior to matz ruby, just the
method cache and thread support is missing. And this compiler has no
optimizations at all yet, not even trivial constant folding. Still 200x
faster. This lua with mop VM can be used for every dynamic language, like
ruby, perl, python, PHP, ... and will beat rpython or truffle/graal by
lengths. The other VM based on this tvmjit ditto. This uses even luajit with
s-expressions.

------
ksec
HN show there is 37 Comment in this thread. And I am only seeing 11.

What is the causes of this?

~~~
detaro
refresh the page? if still not the right number, that sounds like a bug and
you should contact the mods with details - for me everything looks right.
Their e-mail address is in the footer.

------
DonbunEf7
I am disappointed to see Topaz missing from the lineup, but I suppose that it
never had strong adoption in the Ruby community.

------
bedros
please don't use RTL, since it's commonly used for Hardware/chip design
languages such as Verilog and VHDL

~~~
chrisseaton
That's register transfer level. This is register transfer language. The names
are similar, but the technology is unrelated.

[https://en.wikipedia.org/wiki/Register-
transfer_level](https://en.wikipedia.org/wiki/Register-transfer_level)

> Register-transfer level ... Not to be confused with Register transfer
> language.

~~~
richdougherty
And it is already an established term:
[https://en.wikipedia.org/wiki/RTL](https://en.wikipedia.org/wiki/RTL)

