Skip to content

Commit 2013d53

Browse files
committed
Step 6: Explain the results site and the two workflows
CONTRIBUTING: how to run a few benchmarks on a few builds and build the site from them, which builds to leave out on an Apple silicon Mac, and what each workflow does.
1 parent b2ffafc commit 2013d53

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/Gemfile.lock
44
/results/
55
/_site/
6+
/cross-ruby/

‎CONTRIBUTING.md‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ These idioms list here are trying to satisfy following goals:
1212

1313
- [Note on entry](#note-on-entry)
1414
- [Running it on other Rubies](#running-it-on-other-rubies)
15+
- [The results site](#the-results-site)
1516
- [Benchmarks that need a newer Ruby](#benchmarks-that-need-a-newer-ruby)
1617
- [License](#license)
1718

@@ -104,23 +105,25 @@ RUBY_VARIANT=yjit RUBY_VARIANT_FLAGS=--yjit docker compose run --rm ruby_3.4 cod
104105
RUBY_VARIANT=zjit RUBY_VARIANT_FLAGS=--zjit docker compose run --rm ruby_4.0 code/your-new/entry.rb
105106
```
106107

107-
To keep the results, set `RESULTS_DIR`. Each benchmark then also writes its
108-
report as JSON to `results/<label>/`, with the Ruby, its flags and the machine
109-
it ran on:
108+
## The results site
109+
110+
The results site (https://fastruby.github.io/fast-ruby/) compares Rubies, so every build of a benchmark has to run on the same machine.
111+
`script/run_cross_ruby.rb` (Ruby 3 on your machine, it calls Docker) does that, and runs the newest released MRI again after every 3 builds, so the site can show how steady the machine was.
112+
To see a few benchmarks the way the site shows them, run them on a few builds, build the site into `_site/`, then open `_site/index.html` in a browser:
110113

111114
```
112-
RESULTS_DIR=results RESULTS_LABEL=ruby_3.4 docker compose run --rm ruby_3.4 code/your-new/entry.rb
115+
ruby script/run_cross_ruby.rb --files code/date/iso8601-vs-parse.rb,code/string/gsub-vs-tr.rb --builds ruby_3.4,ruby_3.4+yjit,ruby_4.0 --out cross-ruby
116+
docker compose run --rm -T --entrypoint ruby ruby_4.0 script/build_results_site.rb cross-ruby _site
113117
```
114118

115-
To see those results the way the results site shows them, build the site
116-
into `_site/`, then open `_site/index.html` in a browser:
119+
`ruby script/run_cross_ruby.rb --help` lists the options.
120+
The builds are the ones in the CI matrix (`.github/workflows/benchmarks.yml`), so a new Ruby added there and in `compose.yaml` is measured too, and once released it becomes both the reference and the Ruby the site opens on.
121+
On an Apple silicon Mac, leave out `ruby_2.1` and `jruby_9.1` (they run under emulation, so their numbers are not comparable) and `ruby_3.1+yjit` (Ruby 3.1's YJIT only exists on x86-64).
117122

118-
```
119-
docker compose run --rm -T --entrypoint ruby ruby_4.0 script/build_results_site.rb results _site
120-
```
123+
CI has two workflows:
121124

122-
CI does the same after every run: the site is attached to the run as the
123-
`site-preview` artifact, and published to GitHub Pages from `main`.
125+
- `.github/workflows/benchmarks.yml` checks that every benchmark runs on every Ruby: on a PR, the benchmark files it changes; on `main`, all of them when a benchmark or a shared file changed. It publishes nothing.
126+
- `.github/workflows/results-site.yml` runs every build on every file once a week, split over 6 machines, and publishes the site. Run it by hand from the Actions tab to publish sooner.
124127

125128
## Benchmarks that need a newer Ruby
126129

0 commit comments

Comments
 (0)