Write native Ruby extensions in Rust to replace slow Ruby methods with high-performance Rust implementations.
Ruru is a framework for writing native Ruby extensions in Rust. It enables developers to replace slow Ruby methods with high-performance Rust implementations while keeping the same Ruby API, allowing incremental optimization of Ruby applications.
Ruby developers working on performance-critical applications who want to leverage Rust's speed and safety without rewriting their entire codebase.
Ruru provides a seamless bridge between Ruby and Rust, offering true parallelism, type-safe conversions, and a familiar DSL for defining Ruby classes—making it easier to optimize Ruby code than using raw FFI.
Native Ruby extensions written in Rust
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Allows releasing the GVL (Global VM Lock) to run Rust code in parallel with Ruby threads, enabling significant performance gains for CPU-bound tasks, as shown in the heavy computation example.
Provides verified object conversions between Ruby and Rust types with proper error handling, reducing runtime errors and improving safety, demonstrated in the safe conversions section.
Enables replacing individual Ruby methods or classes with Rust implementations without changing the public API, facilitating gradual optimization without breaking existing code.
Offers a Rust-based DSL for defining Ruby classes, methods, and constants, making integration intuitive and similar to writing Ruby code, as seen in the class definition examples.
Requires Ruby to be built with --enable-shared and involves manual compilation steps like using dylibs and Fiddle for loading, which can be error-prone and platform-dependent.
As a work-in-progress project noted in the README, it has limited documentation, community support, and may have breaking changes or undiscovered bugs.
Necessitates proficiency in Rust, which can be a barrier for Ruby-only teams and adds development overhead, especially for those unfamiliar with systems programming.