Hacker News new | past | comments | ask | show | jobs | submit login
RuJIT – Trace-based JIT Compiler for Ruby (github.com/imasahiro)
88 points by ksec on Sept 20, 2014 | hide | past | favorite | 14 comments



From http://brewhouse.io/blog/2014/09/19/ruby-kaigi-2014-day-2

RuJIT is a Trace-based JIT compiler, similar to the approach taken by Firefox’s JS VM. It is based on the current version of CRuby, and resulted in ~2-5X speedup compared to trunk (and up to 100X in some cases).

Note: The Firefox JS VM in the article was referring to Tracemonkey. Mozilla abandoned it and use Method JIT Compiler IonMonkey instead. A better Trace Based JIT example would be LuaJIT.


Doesn't Firefox use IonMonkey for general method JITing and TraceMonkey for hotspots?


No. Firefox has an interpreter, a baseline method JIT ("Baseline"), and an optimizing method JIT (IonMonkey). TraceMonkey was removed several years ago after JaegerMonkey got type inference (see http://blog.mozilla.org/nnethercote/category/tracemonkey/).


Indeed. Pypy is another example of a trace based jit.


Looking at jit_codegen.c, seems it compiles a low-level IR to C, throws that in a file and invokes cc on it (see cgen_freeze). Functions are pulled out with dlsym.

Pretty heavy machinery for a JIT... but there's a comment about an LLVM backend, so I suspect this is a temporary arrangement. It seems this project is in its very early days.


Confusingly similar name to the new .NET JIT; "RyuJIT"! http://blogs.msdn.com/b/dotnet/archive/2013/09/30/ryujit-the...


Whether we see the face of this in Ruby some day or not, I'm just really glad people are putting effort and work into making Ruby faster. Whatever you can do and say about the language, the fact remains that sometimes, the productivity and expressivity you gain by using it is quite simply overshadowed by the weight and sluggishness of the code it helps you produce.


Interesting, but the github README looks like it was simply forked from Ruby proper. Some more explanation would be nice before source-diving.


I think that from this commit

https://github.com/imasahiro/rujit/commit/eb2e6cc5da47c212e8...

To this one

https://github.com/imasahiro/rujit/commit/c0e131bad4f0551425...

resides the JIT implementation; it was better if it was a real fork of Ruby Git, so one could compare Ruby master to RuJIT in order to look at the changes.


Did anyone compile and benchmark it?


I can't get it to compile on Mac or Linux but haven't dug into it yet.


there is another readme: https://github.com/imasahiro/rujit/blob/rujit/README.rujit.m...

sadly, it doesn't say much.


I would have thought at this news as a big fat news on Ruby blogs, people who dream to merge it into official MRI, +1000 points on HN... instead it seems to be quite ignored; am I the only one interested in Ruby performances?


It's 13 days old and entirely undocumented (at least in English). I think it's probably a bit too early to say it's ignored.

I also think that a lot of the attention to Ruby performance has moved on from CRuby (for better or for worse) and on to other implementations like Rubinius and JRuby.

As for HN points, I think it's not sparking a lot of discussion yet because it's difficult to understand. The approach and architectural specifics aren't documented as far as I can tell and the code isn't forked / branched on GitHub so effort is required to even figure out what code has changed at all.

I'd expect this project to get more popular once the talk describing it is released and people have had a chance to look at it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: