Re:JIT and Ruby's MJIT
by mrtweetyhack on Friday December 06, 2019 @07:18PM
(#21727474)
"If you can’t write the .c files to compile, you can’t compile them." So it generates C, why not just compile the C into an executable?
[ Parent
| on HN ]
It does. If you’re asking why not AOT compile a whole ruby app? Well Ruby is a really dynamic language and the generated C might not be valid after the app begins execution. I guess theoretically you could enumerate all of the different possible class states or the final class states but that sounds really hard.
If you actually need a compiled Ruby binary mRuby is the best option but it has its own drawbacks of course.
At least as of Ruby 2.6 I tried that and it really didn't work: http://engineering.appfolio.com/appfolio-engineering/2018/4/...
It may work a bit better now, but it's still very much not tuned for that. The result would probably still be slower than not JITting, for the same reasons mentioned for 2.6 in that link.