Ruby previews pure Ruby JIT compiler

Ruby 3.3.0 brings significant performance improvements to YJIT and previews RJIT, an experimental just-in-time compiler that doesn’t require a C compiler at runtime.

Ruby, gem, programming language - shutterstock
Finesell/Shutterstock

Ruby 3.3.0, a planned upgrade to the popular dynamic language, introduces an experimental, pure-Ruby, just-in-time compiler, called RJIT. The update also brings a number of improvements and a performance boost to the YJIT compiler.

A first preview of Ruby 3.3.0, unveiled May 12, can be downloaded from ruby-lang.org. RJIT, not now usable for production purposes, replaces the MJIT (Method-based Just in Time) compiler. Unlike MJIT, RJIT does not require a C compiler at runtime. Ruby developers should continue to use the Shopify-built YJIT (Yet Another Ruby JIT) compiler in production.

YJIT offers significant performance improvements in Ruby 3.3.0, Ruby proponents said. Registers are allocated for stack operations of the virtual machine and more calls with optional arguments are compiled. Metadata for compiled code uses much less memory, and code generation on the Arm64 architecture has been improved. YJIT now can be started in a paused mode and enabled manually when an application is done booting. Finally, YJIT’s exit tracing option now supports sampling.

Elsewhere in Ruby 3.3.0, defined?(@ivar) has been optimized with Object Shapes to improve performance, and a number of default gems in the standard library have been updated including RubyGems, bigdecimal, bundler, and syntax_suggest.

The current version of Ruby, Ruby 3.2.2, announced March 30, brought security fixes. Ruby 3.2.0, which arrived on Christmas Day, featured WASI (WebAssembly System Interface) support.

Copyright © 2023 IDG Communications, Inc.