Ruby and Rails in 2022: What Mattered, and What’s Next

Shopify’s Senior Staff Engineer and Rails core team member Aaron Patterson—better known as Tenderlove—took a look back at the Ruby and Rails developments that defined 2022. His picks span performance internals and developer tooling, and his hopes for 2023 center on tighter integration between languages, frameworks, and editors.

YJIT Lands on ARM

The YJIT team spent the year rewriting the Ruby compiler in Rust. The move was driven by maintainability: the C implementation had become unwieldy, and the Rust port produces better and faster machine code. But the headline isn't just speed—YJIT also gained the ability to generate machine code for ARM machines. That means you can run YJIT in production on ARM hardware and on Apple Silicon development machines alike. As Patterson notes, ruby --yjit now works consistently across development and production environments.

Variable Width Allocation Becomes Default

Before Ruby 3.2, objects were allocated at a fixed width of 40 bytes. Ruby stored instance variable references inline within the object itself, which allowed up to three references before spilling into an external buffer. That buffer could sit far from the original object in memory, forcing Ruby to hit main memory instead of CPU caches.

The Variable Width Allocation project addressed this by removing the assumption that all objects share one width. When an object needs more slot space than initially allocated, the system learns from that and allocates subsequent instances of the same class from a pool with wider slots. The result is better data locality, with instance variables embedded directly in the object rather than scattered in memory.

Object Shapes Arrive in Ruby 3.2

Object Shapes is an optimization added for Ruby 3.2 that gives every object a “shape” representing its properties and the order in which they were set. Each instance variable assignment changes the shape, and the shape’s ID serves as a cache key for inline caches. Crucially, the cache key is independent of the object’s class—any object that sets the same instance variables in the same order can benefit, regardless of its class hierarchy. That's particularly useful for frameworks like Active Record with many subclasses.

Previously, the cache key was class-based. Two instances of different classes executing @a = 1 would miss the cache even though the operation was identical. With shapes, the class is irrelevant—only properties and their order matter, so those operations now hit inline caches. The technique is common in JavaScript engines and has now made its way into Ruby.

Ruby LSP: A Language Server for Ruby

Ruby LSP is a language server for Ruby, providing formatting, documentation lookup, jump-to-definition, and syntax highlighting within editors that support LSP. It's designed specifically for Ruby and Rails applications, and Shopify has invested heavily in making it work well for its developers. Patterson hopes it will serve the broader community equally well.

Each supported feature on the project’s documentation page includes a GIF demonstration—for example, the Formatting page shows Ruby LSP cleaning up code inside VS Code. Patterson sees this as a major productivity win for Ruby and Rails development.

Error Highlights Reach Rails Error Pages

Error Highlight, a gem written by Yusuke Endoh (Mame), was bundled with Ruby starting in version 3.1. It enhances exception output with column information and ASCII art showing exactly where in the code an error occurred—a useful improvement for anyone debugging deeply nested hashes pulled from JSON.

Take a typo in an extract method: older Ruby versions would display a stack trace with a line number but no column detail. With Error Highlight (Ruby 3.1+), the output includes caret markers (^^^^^) pointing at the precise offending code, making the problem immediately visible.

What's new this year is that Mame integrated this information into Rails error pages. Now, when an exception occurs during Rails development, the error page shows the exact location of the error inline.

Patterson’s 2023 Wish List

Looking ahead, Patterson frames his predictions as more of a wishlist. He notes that Ruby performance should continue improving year over year, but the bigger opportunity lies in developer ergonomics. Good error messages, editor integration, and documentation, he argues, are now table stakes for any programming language.

His hope for next year: languages, frameworks, and development environments become more interconnected, offering better suggestions, more assistance, and richer context about code. The goal is to spend less time on plumbing and more time on problem solving.

Ruby and Rails Coverage From Shopify in 2022

Shopify’s Ruby and Rails Infrastructure team published a steady stream of deep technical work throughout 2022. The articles below cover execution models, string internals, dependency analysis, and more—material that rewards a second read if you missed it the first time.

Aaron Patterson is a Senior Staff Engineer on Shopify’s Ruby and Rails Infrastructure team and a Ruby on Rails Core Team member. He writes publicly as Tenderlove and can be reached on GitHub and Mastodon.