Skip to content
A NES emulator written in Ruby
Ruby JavaScript
Branch: master
Clone or download
Latest commit ded9d93 Sep 17, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc Mention `optcarrot-bench` Sep 17, 2019
examples Publish. Mar 31, 2016
lib Misc. for rubocop Jun 14, 2019
tools Update rubocop directives Dec 19, 2018
.dockerignore Revert "Generate .dockerignore dynamically" Jul 3, 2018
.gitignore Publish. Mar 31, 2016
.travis.yml Retry. Jun 11, 2016
Gemfile Update benchmark_driver YAML for RubyBench Jun 30, 2018
LICENSE Add LICENSE Dec 29, 2017 Show the charts first Dec 30, 2017
Rakefile Publish. Mar 31, 2016
benchmark.yml Update benchmark_driver YAML for RubyBench Jun 30, 2018
optcarrot.gemspec Cosmetics to make Rubocop happy Apr 12, 2018

Optcarrot: A NES Emulator for Ruby Benchmark

Project Goals

This project aims to provide an "enjoyable" benchmark for Ruby implementation to drive "Ruby3x3: Ruby 3 will be 3 times faster".

The specific target is a NES (Nintendo Entertainment System) emulator that works at 20 fps in Ruby 2.0. An original NES works at 60 fps. If Ruby3x3 is succeeded, we can enjoy a NES game with Ruby!

NOTE: We do not aim to create a practical NES emulator. There have been already many great emulators available. We recommend you use another emulator if you just want to play a game.

Basic usage

SDL2 is required.

$ git clone
$ cd optcarrot
$ bin/optcarrot examples/Lan_Master.nes
key button
arrow D-pad
Z A button
X B button
space Start button
return Select button

See doc/ for advanced usage.

Benchmark example

benchmark chart

See doc/ for the measurement condition and some other charts.

See also Ruby Releases Benchmarks and Ruby Commits Benchmarks for the continuous benchmark results.

You may also want to read @eregon's great post for TruffleRuby potential performance after warm-up.

Optimized mode

It may run faster with the option --opt.

$ bin/optcarrot --opt examples/Lan_Master.nes

This option will generate an optimized (and super-dirty) Ruby code internally, and replace some bottleneck methods with them. See doc/ in detail.

See also


We appreciate all the people who devoted efforts to NES analysis. If it had not been not for the NESdev Wiki, we could not create this program. We also read the source code of Nestopia, NESICIDE, and others. We used the test ROMs due to NESICIDE.

You can’t perform that action at this time.