Ruby 3.1 arrives with new JIT compiler

Still-experimental YJIT just-in-time compiler promises faster warmup and performance improvements on most real-world Ruby software.

Ruby 3.1 arrives with new JIT compiler
Toa55 / Getty Images

The Ruby community has released Ruby 3.1, an upgrade to the open source dynamic programming language that introduces a new in-process JIT (just-in-time) compiler to improve the performance of Ruby applications.

Introduced on Christmas Day, Ruby 3.1, or Ruby 3.1.0, adds the YJIT (Yet Another Ruby JIT), a lightweight, minimalistic Ruby JIT built inside CRuby. YJIT uses a Basic Block Versioning architecture, with a JIT compiler inside of it. YJIT achieves fast warmup and performance improvements on most real-world software, Ruby’s developers said. But YJIT still is in an experimental stage and is disabled by default. To use it, developers must specify the –yjit command-line option. YJIT currently is limited to Unix-like x86-64 platforms.

Download instructions for Ruby 3.1 can be found at ruby-lang.org. Other new features and improvements in Ruby 3.1 include:

  • A completely rewritten debug.gem boosts debugging performance and supports remote and multi-process debugging. It also can serve as a front end for the Visual Studio Code editor and Chrome browser and provides a REPL.
  • A built-in gem, error_highlight, offers fine-grained error location in backtraces.
  • The IRB (Interactive Ruby) tool now has an autocomplete feature, where developers type in the code and the completion candidates dialog will appear.
  • TypeProf, a static analyzer, is featured.
  • MJIT compiler performance has been improved.
  • Among the new language features, values in Hash literals and keyword arguments can be omitted, the pin operation (^) in pattern matching now takes an expression, and parentheses can be omitted in one-line pattern matching.
  • Multiple updates have been made to the standard library including updates to default gems such as RubyGems 3.3.3.

Ruby 3.1 arrives one year after Ruby 3.0.0, which featured new parallel execution and type description capabilities.

Copyright © 2022 IDG Communications, Inc.