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.
Copyright © 2023 IDG Communications, Inc.