Ruby implementation with yet another JIT compiler written in Rust.
Presentation movie and slides for RubyKaigi2024 are here and here.
- Written in Rust from scratch. No dependencies on any other Ruby implementations.
- Fast. Currently, monoruby is comparable to ruby3.4.1+YJIT in the optcarrot benchmark.
- Hand-written original parser.
- Register-based bytecode.
- Bytecode executor (virtual machine) written in x86-64 assembly (yes, we currently support only x86-64!).
- A compact and fast just-in-time compiler. (internally using self-made dynamic assembler monoasm)
Currently, only x86-64/linux is supported.
Please see wiki for details.
(1) Install nightly Rust.
First of all, install Rust nightly. Check here to install Rust
Caution!! only nightly Rust works for monoruby. See here to work with nightly Rust.
(2) Clone this repository.
> git clone https://github.com/sisshiki1969/monoruby.git
> cd monoruby
(3) Build and run monoruby with Ruby script file.
> cargo run --release -- test.rb
(4) Launch REPL.
> cargo run --bin irm
or
> bin/irm
To install monoruby,
> cargo install --path monoruby
Now, you can play with monoruby,
> monoruby test.rb
and its REPL.
> irm
Several Ruby implementations described below were measured by optcarrot benchmark. Please see wiki for details.
- ruby 3.4.0dev (2024-04-27T08:56:20Z master 9ea77cb351) [x86_64-linux]
- truffleruby 24.0.1, like ruby 3.2.2, Oracle GraalVM JVM [x86_64-linux]
- truffleruby 24.0.1, like ruby 3.2.2, Oracle GraalVM Native [x86_64-linux]
- monoruby: 3e348afd4141c40978342e67ad26d42dc0b8d2a7
Several Ruby implementations described below were measured bymeasured by yjit-bench. Please see wiki for details.
- monoruby: monoruby 0.3.0
- yjit: ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [x86_64-linux]
- truffleruby-24.1.1: truffleruby 24.1.1, like ruby 3.2.4, Oracle GraalVM Native [x86_64-linux]
The graph shows the speed ratio against truffleruby. (higher is better)