Skip to content

Commit c1d8d44

Browse files
committed
Document how to run a single benchmark
1 parent 9fb8d96 commit c1d8d44

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,30 @@ the [Shopify/yjit](https://github.com/Shopify/yjit) repository.
77
The benchmarks are found in the `benchmarks` directory. Individual Ruby files
88
in `benchmarks` are microbenchmarks. Subdirectories under `benchmarks` are
99
larger macrobenchmarks. Each benchmark relies on a harness found in
10-
`/lib/harness.rb`. The harness controls the number of times a benchmark is
11-
run, and writes timing values into an output CSV file.
10+
[./harness/harness.rb](harness/harness.rb). The harness controls the number of times a benchmark is
11+
run, and writes timing values into an output file.
1212

13-
The `run_benchmarks.rb` script traverses the `benchmarks` directory and
13+
The `run_benchmarks.rb` script (optional) traverses the `benchmarks` directory and
1414
runs the benchmarks in there. It reads the
1515
CSV file written by the benchmarking harness. The output is written to
1616
an output CSV file at the end, so that results can be easily viewed or
1717
graphed in any spreadsheet editor.
1818

19-
yjit-bench expects to use chruby to run with YJIT.
19+
## Running a single benchmark
2020

21-
## Installation
21+
This is the easiest way to run a single benchmark.
22+
It requires no setup at all and assumes nothing about the Ruby you are benchmarking.
23+
It's also convenient for profiling, debugging, etc, especially since all benchmarked code runs in that process.
24+
You can also use another harness or make your own by passing a different directory for `-I`.
2225

23-
Install [chruby](https://github.com/postmodern/chruby)
26+
```
27+
ruby -Iharness benchmarks/some_benchmark.rb
28+
```
29+
30+
## Installation to use run_benchmarks.rb
31+
32+
`run_benchmarks.rb` expects to use chruby to run with YJIT, so you need to
33+
install [chruby](https://github.com/postmodern/chruby).
2434

2535
Clone this repository:
2636
```

0 commit comments

Comments
 (0)