2 min Devops

Ruby 3.2.0 includes a host of new features

Ruby 3.2.0 includes a host of new features

The new release features WebAssembly support, production-ready YJIT optimization and more.

Ruby 3.2.0 was recently made available. The release includes major features like WASI-based WebAssembly support.

As maintainer Yui Naruse explained in his release announcement, it’s “an initial port of WASI-based WebAssembly support” that enables a CRuby binary to be available on a web browser, a serverless edge environment and other kinds of WebAssembly/WASI embedders.

He added that for now, this port passes basic and bootstrap test suites not using the Thread API.

Production-ready YJIT

Secondly, there’s the first non-experimental release of YJIT (Yet another Just-in-Time Compiler). Naruse explained that “YJIT is no longer experimental” and has actually been tested on production workloads for over a year.

He added that the compiler has “proven to be quite stable”. In fact, Ruby’s YJIT now supports both x86-64 and arm64/aarch64 CPUs on Linux, macOS, BSD and other UNIX platforms.

The new release brings support for Apple M1/M2, AWS Graviton, Raspberry Pi 4 and more, according to Naruse. Perhaps most significantly, the YJIT 3.2 release performs better than 3.1. In fact, YJIT is 41 percent faster (geometric mean) overall than the Ruby interpreter on yjit-bench from Shopify.

Other features

Another new feature is a greatly enhanced Regexp (Regular Expression) algorithm. Naruse’s post shows that the new RegEp can significantly improve performance. Naruse demonstrated an expression which took 10 seconds to run in Ruby 3.1 and now completes in 0.003 seconds.

The new release also features SyntaxSuggest. The expression syntax_suggest (formerly dead_end) is now integrated into Ruby. “This helps you find the position of errors such as missing or superfluous ends, to get you back on your way faster”, Naruse said.

In addition, Bundler 2.4 now uses PubGrub resolver instead of Molinillo. PubGrub is the next-generation solving algorithm used by pub package manager for the Dart programming language.