4 ms·
"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?
by mrtweetyhack 7y ago
"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?
- sosodev 7y agoIt 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.
- angelbob 7y agoAt least as of Ruby 2.6 I tried that and it really didn't work: http://engineering.appfolio.com/appfolio-engineering/2018/4/3/ruby-26-and-ahead-of-time-compilation 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.