20 years since open source release, here comes Ruby on Rails 7.2 with JIT compiler and more

20 years since open source release, here comes Ruby on Rails 7.2 with JIT compiler and more

The Ruby on Rails team has released version 7.2, with new features including YJIT (Yet Another Just-in-Time compiler) enabled by default and auto generation of development containers. The minimum Ruby version is now 3.1, but for YJIT to be the default, you need Ruby 3.3 or newer.

YJIT was developed by the Ruby team at GitHub and Shopify, and is a project that dates back five years or so. It was first written in C and later ported to Rust, for increased safety and better tools to manage its complexity. According to the Shopify engineers, YJIT in Ruby 3.2 gives a 38 percent speed-up over using the interpreter – though there were concerns over high memory usage. 

The Rails team promises a more modest 15–25 percent latency improvement, and the default docker deployment includes a library called jemalloc to optimize memory allocation. The default number of threads used by the Puma web server (the default for Rails) has been reduced from five to three, based on “battle-tested experience from applications running in production,” since there are trade-offs when the thread count is too high.

Another feature in Rails 7.2 is the ability to generate a dev container configuration – either when creating a new skeleton application with the rails new command, or by adding it to an existing application with rails devcontainer. The default dev container includes a Redis container, a database which can be SQLite, PostgreSQL, MySQL or MariaDB, and a headless Chrome container for tests. The feature presumes use of Microsoft’s VS Code and the Dev Containers extension. Further development takes place in the dev container environment, ensuring a consistent environment within a team, and isolation of development dependencies from the host computer system.

The full release notes for Rails 7.2 describe other new features, including the ability to block unsupported browser versions, and files for supporting progressive web applications added by default – enabling the Rails application to run with some of the characteristics of an installed desktop application. Brakeman, a static analysis security tool for Rails, is now added by default. 

Rails is an opinionated web application framework for Ruby which embraces the principle of convention over configuration and the ActiveRecord object-relational mapper, enabling rapid development of data-driven applications. Rails was created by David Heinemeier Hansson and first released as open source in July 2004, making it now 20 years old as an open source project. 

GitHub posted in June that “since the beginning, GitHub.com has been a Ruby on Rails monolith. Today, the application is nearly two million lines of code and more than 1,000 engineers collaborate on it daily. We deploy as often as 20 times a day, and nearly every week one of those deploys is a Rails upgrade.”

Why Rails? “To paraphrase Steve Jobs, ‘Rails is like a glass of ice-water in React Hell!” said one developer.