5 ms·
Did we get JIT?
by maxpert 6y ago
Did we get JIT?
- anonova 6y agoYes, it was introduced in Ruby 2.6 (2018): https://www.ruby-lang.org/en/news/2018/12/25/ruby-2-6-0-released/ https://www.ruby-lang.org/en/news/2018/12/25/ruby-2-6-0-rele...
- pizza234 6y agoWell, yes and no (althought the question is a bit open). It's more or less beta quality, and very primitive. It's discouraged to be used with Rails, so I'd be inclined to state that "we didn't get it yet". I'm also personally skeptical that the unusual approach (invoking a whole C compiler in a separate thread) will stand in the long term - but that's my own take.
- jashmatthews 6y agoThe CRuby JIT is stable but whether it improves performance or not is workload dependent. It's simple not primitive. MJIT is designed to take advantage of a C compilers optimization. "Compile to C" worked for Chicken Scheme for the past 20 years and continues to be a popular way for functional langauges to compile. It's also how Nim works. It's all about different trade-offs.
- oblio 6y agoChicken Scheme compiles ahead of time, doesn't it?
- pansa2 6y agoNim does too.
- jashmatthews 6y agoYeah but it's not an important distinction.
- oblio 6y agoIsn't it? Compiling C takes time, with Ruby you would be doing it for each execution. Is there some catching involved?
- jashmatthews 6y agoAlmost everything is in a pre-compiled header. Its actually similar overhead to an LLVM based JIT. You wouldn’t want to do it for a browser JIT but for a server side app it’s OK.
- oblio 6y agoDoes Ruby ship with a compiler? How will this work on Windows?
- pizza234 6y agoAre there any benchmarks available? It seems I can find very little (OptCarrot, some microbenchmarks, and some general assessments about usage with Rails), and a broad(er) overview is crucial to assess the overall performance (I suppose that you can have workloads where the performance degrades).
- ljm 6y agoI wonder what happened to that old planned feature where the ruby code would be byte-compiled into .rbc files?
- byroot 6y agoThe capability is there since 2.3 at least, but Matz doesn't want it by default, and prefer to leave it to libraries. If you use bootsnap, you use ".rbc" files already. Source: https://bugs.ruby-lang.org/issues/16847#note-14 https://bugs.ruby-lang.org/issues/16847#note-14
- jashmatthews 6y agoJRuby has a semi-optimizing JIT since JRuby 9000 was released in 2015. It's mostly non-speculative but still the fastest way to run Ruby in production. I've used it at several companies.