How-To - Write Benchmarks - Rubinius
Author: Less Than Three. <3. http://less.thanthree.com
Description: Rubinius is an implementation of the Ruby programming language. The Rubinius bytecode virtual machine is written in C++. The bytecode compiler is written in pure Ruby. The vast majority of the core library is also written in Ruby, with some supporting primitives that interact with the VM directly.

1.2.3

## How-To - Write Benchmarks

Why benchmarks?

Benchmarks are a great tool for comparing Rubinius with the rest of the Ruby runtimes, i.e. MRI, JRuby, IronRuby and other implementations. It is not so much intended to measure Rubinius itself so if you want to contribute writing benchmarks make sure to follow these steps:

1. Find existing benchmarks in rubinius/benchmarks and study their layout.
2. Each benchmark file should measure one specific aspect of Ruby. For example different ways of deleting keys/values from a Hash.
3. Use the benchmark framework.
4. Keep the benchmarks short and simple.
5. The benchmarks are not meant to measure Rubinius. So if you’re writing a benchmark for a class with bang and no-bang methods you will want to use a duplicate of a variable in the bang method but you don’t need to dup in the no-bang method.

If you want to test a benchmark you can run it file or even directory wise:

    bin/benchmark benchmark/core/string/bench_case.rb
    bin/benchmark benchmark/core