Ruby, the dynamic programming language beloved for its simplicity and flexibility, is gearing up for a major performance boost with the introduction of a new just-in-time (JIT) compiler in the upcoming Ruby 3.1.0 version. This new feature, called YJIT (Yet Another Ruby JIT), is designed to enhance the execution speed of Ruby applications, particularly those built with Ruby on Rails. As of November 9, Ruby 3.1.0 is available for preview, allowing developers to experiment with this exciting new addition. Although YJIT is still an experimental feature, its integration marks a significant step forward for Ruby’s performance capabilities.
Developed by Shopify, YJIT is a basic block versioning JIT compiler that aims to improve both the startup time (warmup) and overall performance of Ruby applications. According to the Ruby language team, YJIT is specifically tuned to optimize real-world software performance, making it a promising tool for developers working on larger applications or systems where execution speed is critical. However, it’s worth noting that YJIT is currently disabled by default, and developers who wish to use it will need to activate it manually via the --yjit
command-line option.
At this stage, YJIT is only supported on MacOS and Linux platforms with x86-64 architectures. Ruby 3.1.0 also brings other noteworthy updates beyond the JIT compiler. The new version introduces a revamped debugger called debug.gem
, which replaces the previous lib/debug.rb
standard library. This new debugger promises faster performance, remote debugging capabilities, and even enhanced support for Visual Studio Code, making it a more powerful tool for developers debugging their Ruby code.
Other improvements in Ruby 3.1.0 include a built-in gem called error_highlight
, which offers more precise error location in backtraces, making it easier for developers to pinpoint issues in their code. Additionally, the language itself sees some refinements, such as the ability to omit values in Hash literals and keyword arguments. Ruby’s static type system, managed by RBS (Ruby Signature), also receives updates, including a new rbs collection
feature to better manage gem signatures and several bug fixes and performance improvements. Meanwhile, the MJIT compiler’s performance has been improved, further optimizing Ruby’s execution speed. With these advancements, Ruby 3.1.0 is shaping up to be a major update for developers focused on both performance and productivity.