Posted by naruse on 25 Dec 2025 We are pleased to announce the release of Ruby 4.0.0. Ruby 4.0 introduces “Ruby Box” and “ZJIT”, and adds many improvements. Ruby Box Ruby Box is a new (experimental) feature to provide separation about definitions. Ruby Box is enabled when an environment variable RUBY_BOX=1 is specified. The class is Ruby::Box. Definitions loaded in a box are isolated in the box. Ruby Box can isolate/separate monkey patches, changes of global/class variables, class/module definitions, and loaded native/ruby libraries from other boxes. Expected use cases are: Run test cases in box to protect other tests when the test case uses monkey patches to override something Run web app boxes in parallel to execute blue-green deployment on an app server in a Ruby process Run web app boxes in parallel to evaluate dependency updates for a certain period of time by checking response diff using Ruby code Used as the foundation (low-level) API to implement kind of “package” (high-level) API (it is not designed yet) For the detail of “Ruby Box”, see Ruby::Box. [Feature #21311] [Misc #21385] ZJIT ZJIT is a new just-in-time (JIT) compiler, which is developed as the next generation of YJIT. You need Rust 1.85.0 or newer to build Ruby with ZJIT support, and ZJIT is enabled when --zjit is specified. We’re building a new compiler for Ruby because we 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). See our blog post for more details. ZJIT is faster than the interpreter, but not yet as fast as YJIT. We encourage you to experiment with ZJIT, but maybe hold off on deploying it in production for now. Stay tuned for Ruby 4.1 ZJIT. Ractor Improvements Ractor, Ruby’s parallel execution mechanism, has received several improvements. A new class, Ractor::Port, was introduced to address issues related to message sending and receiving (see our blog post). Addition...
First seen: 2025-12-25 05:48
Last seen: 2025-12-26 03:50