| Ruby 4 Adds Ruby Box On Its 30th Anniversary |
| Written by Kay Ewbank | |||
| Thursday, 08 January 2026 | |||
|
Ruby 4 has been released with new features including a new just-in-time compiler called ZJIT and an experimental sandbox called Ruby Box. The new version also adds features to the experimental parallel execution mechanism, Ractor. As is traditional, Ruby 4.0 was released on December 25th. This also marked its 30th anniversary. Ruby is a high-level language drawing on elements of Perl, Smalltalk, Eiffel, Ada, and Lisp and supporting multiple programming concepts to balance functional, dynamic and object oriented programming. The language designer set out to create a genuine object-oriented, easy-to-use scripting language. Fans say it is fun to use as well as useful. Ruby is often used alongside the Rails application framework.
One headline addition is Ruby Box, which can be used to provide separate spaces in a Ruby process for isolating changes to global/class variables, class/module definitions, and loaded native/ruby libraries from other boxes, as well as monkey patches. Definitions loaded in a box are isolated in the box. The developers expect Ruby Box to be used for running test cases in box to protect other tests when the test case uses monkey patches to override something; and running web app boxes in parallel to execute blue-green deployment on an app server in a Ruby process. Another anticipated use is to run web app boxes in parallel for blue-green deployments on an app server in a Ruby process, and running web app boxes in parallel to evaluate dependency updates for a specific time period by checking response diffs. Ruby Box is currently experimental and there are some known issues. The next addition is ZJIT. This is a new just-in-time (JIT) compiler, which is developed as the next generation of YJIT. The developers are building a new compiler for Ruby because they want to both raise the performance ceiling (bigger compilation unit size and SSA IR) and encourage more outside contribution (by becoming a more traditional method compiler). ZJIT is faster than the interpreter, but not yet as fast as YJIT. Ractor, Ruby's parallel execution mechanism, has received several improvements, including the addition of a new class, Ractor::Port, which addresses issues related to message sending and receiving. Ractor is faster in this version thanks to improving of internal data structures to significantly reduce contention on a global lock, unlocking better parallelism. Ractors also now share less internal data, resulting in less CPU cache contention when running in parallel. Ractor was first introduced in Ruby 3.0 as an experimental feature, and the developers aim to remove its experimental status next year. Ruby 4 is available now.
More InformationRelated ArticlesRuby 3.3 Makes Prism Parser Default Ruby 3.2 Adds WebAssembly Support Ruby 3.1 Adds In-Process JIT Compiler Ruby 3 Released Offering Three Times Better Performance To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info |


