Paul Krill
Editor at Large

Ruvy converts Ruby code to WebAssembly

news
Oct 25, 20232 mins

Open-source toolchain from Shopify promises a straightforward way to build and execute simple Ruby programs in WebAssembly runtimes.

command line
Credit: Thinkstock

E-commerce provider Shopify has open-sourced its Ruvy project, which provides a toolchain that takes Ruby code and creates a WebAssembly module that executes that Ruby code.

Shopify believes Ruvy could be useful to the wider developer community by providing a straightforward way to build and execute simple Ruby programs in WebAssembly runtimes. Introduced October 18, and accessible from GitHub, Ruvy was created to take advantage of performance improvements from pre-initializing the Ruby virtual machine and Ruby files included by the Ruby script.

Ruvy does not require WASI (WebAssembly System Interface) arguments to be provided at runtime, Shopify said, noting that Ruvy Wasm modules take about 70% less time to compile to native code. Ruvy boosts performance by pre-initializing the Ruby virtual machine when the Wasm module is built.

Built on top of ruby.wasm, a collection of WebAssembly ports of CRuby, Ruvy presently does not ship with precompiled binaries, so build dependencies have to be installed and then Ruvy must be compiled before use. Details on installing these dependencies can be found in the project’s ReadMe section. After building Ruvy, developers can run:

$ cargo run --package=cli ruby_examples/hello_world.rb -o index.wasm 
$ wasmtime index.wasm 
Hello world

Wasm files created by Ruvy do not require a file path as a WASI argument. This promotes compatibility with computing environments that cannot be configured to offer additional WASI arguments to start functions, such as some edge computing services, Shopify said.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author