Skip to content

Commit d0df3ac

Browse files
committed
Update rubybench_runner guide
1 parent 0fee19a commit d0df3ac

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

app/helpers/repos_helper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@ def show_gem_tip
55
@benchmark &&
66
@benchmark.category !~ /^discourse_/
77
end
8+
9+
def script_name
10+
@benchmark.script_url.match(/\/([^\/]+)$/)[1]
11+
end
812
end

app/views/repos/_script.html.haml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
- if script_url = benchmark.script_url
22
- if show_gem_tip
3-
%h4.l-align-center
4-
!= t('repos.run_locally_tip', path: run_locally_path)
3+
!= t('repos.run_locally_tip', path: run_locally_path, script: script_name)
54
%h2.l-align-center
65
= t('repos.script_title', graph_name: benchmark.category.humanize)
76

config/locales/en.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ en:
3030
"%{category}" does not have any results. Please select another
3131
Benchmark Type.
3232
view_github: View on Github
33-
run_locally_tip: You can run this benchmark locally using the <code>rubybench_runner</code> gem. More details <a href="%{path}">here</a>.
33+
run_locally_tip: |
34+
<p>You can run this benchmark locally using the <code>rubybench_runner</code> gem:</p>
35+
<pre>gem install rubybench_runner
36+
rubybench_runner run rails/%{script}</pre>
37+
More details <a href="%{path}">here</a>.
3438
3539
index:
3640
commits_benchmark: Commits Benchmarks
@@ -92,7 +96,10 @@ en:
9296
</li>
9397
<li>Pick one of the <a href="https://rubybench.org/rails/rails/commits">available rails benchmarks</a> and copy the GitHub link of the script (it's the "View on Github" button).</li>
9498
<li>Run:
95-
<pre>rubybench_runner run rails &lt;script_url&gt; &lt;path_to_rails_clone&gt;</pre>
99+
<pre>rubybench_runner run rails/&lt;script_name&gt; --rails=/path/to/rails</pre>
100+
You can get <code>script_name</code> from the page of the benchmark that you want to run at rubybench.org.
101+
<br>
102+
If you have Rails cloned in your home directory, you can omit the <code>--rails</code> flag.
96103
</li>
97104
<li>If the benchmark requires a database server, then you need to specify the <code>--db</code> option. Run <code>rubybench_runner --help</code> for details.</li>
98105
</ul>

0 commit comments

Comments
 (0)