Ruby 3.2 Adds WebAssembly Support
Written by Kay Ewbank   
Thursday, 12 January 2023

Ruby 3.2 has been released with an initial port of WASI-based WebAssembly support and production-ready YJIT.

Ruby is a high-level language drawing on elements of Perl, Smalltalk, Eiffel, Ada, and Lisp and supporting multiple programming concepts to balance functional, dynamic and object oriented programming. Fans say it is fun to use as well as useful.

rubylogo2a

The WebAssembly System Interface (WASI) means you'll be able to run Ruby within web browsers and as modules inside larger applications, written in languages such as Java, Python or JavaScript. WASI is designed to be an effective compilation target for source languages such as C, C++, and Rust. The inclusion in Ruby means Ruby code should be able to be run on the web at near-native speed.

The Ruby team say that WASI and WebAssembly are missing some features to implement Fiber, exception, and GC because it’s still evolving, and also for security reasons. CRuby fills the gap by using Asyncify, which is a binary transformation technique to control execution in real life use. The developers have also built a VFS on top of WASI so Ruby apps can be packed into a single .wasm file to make distribution of Ruby apps a bit easier.

ruby yjit performance

The second main improvement to Ruby 3.2 is production-ready YJIT. CRuby already came with a JIT compiler known as MJIT, but YJIT is  a new JIT compiler built inside CRuby based on a Lazy Basic Block Versioning (LBBV) architecture. While this still isn't as fast as some independently re-implemented versions of Ruby such as TruffleRuby, it is near-100% compatibile with existing Ruby code. YJIT has been tested on production workloads for over a year and proven to be quite stable.

The YJIT 3.2 release is faster than 3.1, and has about two thirds less memory overhead. The developers say that overall YJIT is 41 percent faster on the geometric mean benchmark than the Ruby interpreter on yjit-bench.

Ruby 3.2 is available now.

rubylogo2a

More Information

Ruby Official Site

Related Articles

Ruby 3.1 Adds In-Process JIT Compiler

Ruby 3 Released Offering Three Times Better Performance

Ruby On Rails 7 Moves To No-Node Default

Fukuoka Ruby Award 2021 Prestigious Ruby Prize

Ruby 2.6 Adds JIT Compiler

Sorbet - Making Ruby Statically Typed

Ruby 2.5 Adds Support For Branch Coverage

Commercial Ruby Distro Enters Beta

Ruby On Rails Reaches 5.0

Ruby 2.3 Released

ActiveState Extends to Ruby, Node.js, Go and Lua

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Natives In Tech Accuse Apache Of Cultural Appropriation
13/01/2023

The Apache Software Foundation is being urged to change its name and the names of the projects it hosts by members of Natives In Tech, a collective of Native technologists crafting free and open  [ ... ]



CodinGame Findings On Hiring And Getting Hired
25/01/2023

More than one in two developers is considering job hopping with the next year while talent retention has become the top issue on  technical hiring companies' priority list. These are among the fi [ ... ]


More News

picobook

 



 

Comments




or email your comment to: comments@i-programmer.info