Skip to content

Commit

Permalink
Benchmark against CRuby 3.3 to use as a baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
rwstauner committed May 23, 2024
1 parent f77fa63 commit cd1f82d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
11 changes: 9 additions & 2 deletions basic_benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
MJIT_PER_OS_OPTS = SETARCH_OPTS
TRUFFLE_PER_OS_OPTS = {}

BASELINE_RUBY_BUILD = "ruby-3.3.1"

# These are "config roots" because they define a configuration
# in a non-platform-specific way. They're really several *variables*
# that partially define a configuration.
Expand Down Expand Up @@ -96,8 +98,13 @@
opts: MJIT_ENABLED_OPTS + [ "--mjit-verbose=1" ],
per_os_prefix: MJIT_PER_OS_OPTS,
},
"prev_ruby_baseline" => {
build: BASELINE_RUBY_BUILD,
opts: NO_JIT_OPTS,
per_os_prefix: CRUBY_PER_OS_OPTS,
},
"prev_ruby_yjit" => {
build: "ruby-3.3.1",
build: BASELINE_RUBY_BUILD,
opts: YJIT_ENABLED_OPTS,
per_os_prefix: YJIT_PER_OS_OPTS,
},
Expand Down Expand Up @@ -143,7 +150,7 @@
min_bench_itrs: DEFAULT_MIN_BENCH_ITRS,
min_bench_time: DEFAULT_MIN_BENCH_TIME,
}
DEFAULT_CONFIGS = %w(yjit_stats prod_ruby_with_yjit prod_ruby_no_jit prev_ruby_yjit)
DEFAULT_CONFIGS = %w(yjit_stats prod_ruby_with_yjit prod_ruby_no_jit prev_ruby_yjit prev_ruby_baseline)
configs_to_test = DEFAULT_CONFIGS.map { |config| "#{YJITMetrics::PLATFORM}_#{config}"}
bench_data = nil
when_error = :report
Expand Down
7 changes: 7 additions & 0 deletions lib/yjit-metrics/bench-results.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def platforms
# metadata?) and make sure the config does what it's labelled as.
CONFIG_NAME_SPECIAL_CASE_FRAGMENTS = {
"with_yjit" => "YJIT",
"prev_ruby_baseline" => "CRuby 3.3",
"prev_ruby_yjit" => "YJIT 3.3",
"prod_ruby_with_mjit" => "MJIT",
"ruby_30_with_mjit" => "MJIT-3.0",
Expand Down Expand Up @@ -652,6 +653,9 @@ module YJITMetrics
"x86_64_prod_ruby_with_yjit" => {
max_warmup_itrs: 30,
},
"x86_64_prev_ruby_baseline" => {
max_warmup_itrs: 30,
},
"x86_64_prev_ruby_yjit" => {
max_warmup_itrs: 30,
},
Expand All @@ -668,6 +672,9 @@ module YJITMetrics
"aarch64_prod_ruby_with_yjit" => {
max_warmup_itrs: 30,
},
"aarch64_prev_ruby_baseline" => {
max_warmup_itrs: 30,
},
"aarch64_prev_ruby_yjit" => {
max_warmup_itrs: 30,
},
Expand Down
4 changes: 2 additions & 2 deletions lib/yjit-metrics/report_templates/blog_speed_details.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
</p>

<p>
Tested Ruby version for YJIT and No-JIT: <tt><strong><%= @ruby_metadata_by_config[@with_yjit_config]["RUBY_DESCRIPTION"] %></strong></tt> <br/>
Tested Ruby version for CRuby and YJIT: <tt><strong><%= @ruby_metadata_by_config[@with_yjit_config]["RUBY_DESCRIPTION"] %></strong></tt> <br/>
<% if @with_prev_yjit_config %>
Tested Ruby version for Ruby 3.3 YJIT: <tt><strong><%= @ruby_metadata_by_config[@with_prev_yjit_config]["RUBY_DESCRIPTION"] %></strong></tt> <br/>
Tested Ruby version for 3.3 CRuby and YJIT: <tt><strong><%= @ruby_metadata_by_config[@with_prev_yjit_config]["RUBY_DESCRIPTION"] %></strong></tt> <br/>
<% end %>
<% if @with_mjit_latest_config %>
Tested Ruby version for Ruby latest MJIT: <tt><strong><%= @ruby_metadata_by_config[@with_mjit_latest_config]["RUBY_DESCRIPTION"] %></strong></tt> <br/>
Expand Down
6 changes: 4 additions & 2 deletions lib/yjit-metrics/report_types/bloggable_speed_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def look_up_data_by_ruby(only_platforms: YJITMetrics::PLATFORMS, in_runs: false)
raise "No data files for platform(s) #{only_platforms.inspect} in #{@config_names}!" if config_names.empty?

@with_yjit_config = exactly_one_config_with_name(config_names, "with_yjit", "with-YJIT")
@with_prev_baseline_config = exactly_one_config_with_name(config_names, "prev_ruby_baseline", "prev-CRuby", none_okay: true)
@with_prev_yjit_config = exactly_one_config_with_name(config_names, "prev_ruby_yjit", "prev-YJIT", none_okay: true)
@with_mjit30_config = exactly_one_config_with_name(config_names, "ruby_30_with_mjit", "with-MJIT3.0", none_okay: true)
@with_mjit_latest_config = exactly_one_config_with_name(config_names, "prod_ruby_with_mjit", "with-MJIT", none_okay: true)
Expand All @@ -52,7 +53,8 @@ def look_up_data_by_ruby(only_platforms: YJITMetrics::PLATFORMS, in_runs: false)

# Order matters here - we push No-JIT, then MJIT(s), then YJIT and finally TruffleRuby when present
@configs_with_human_names = [
["No JIT", @no_jit_config],
["CRuby <version>", @with_prev_baseline_config],
["CRuby <version>", @no_jit_config],
["MJIT3.0", @with_mjit30_config],
["MJIT", @with_mjit_latest_config],
["YJIT <version>", @with_prev_yjit_config],
Expand Down Expand Up @@ -431,7 +433,7 @@ def svg_object(benchmarks: @benchmark_names)

# Set up the top legend with coloured boxes and Ruby config names
top_legend_box_height = 0.03
top_legend_box_width = 0.1
top_legend_box_width = 0.12
top_legend_text_height = 0.025 # Turns out we can't directly specify this...
legend_box_stroke_colour = "#888"
top_legend_item_width = plot_effective_width / n_configs
Expand Down
4 changes: 3 additions & 1 deletion lib/yjit-metrics/report_types/variable_warmup_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ def look_up_data_by_ruby
# It matters because we want the output reports to be stable with no churn in Git.
bench_configs = YJITMetrics::DEFAULT_YJIT_BENCH_CI_SETTINGS["configs"]
configs = @result_set.config_names
config_order = configs.select { |c| c["prod_ruby_no_jit"] }.sort
config_order = []
config_order += configs.select { |c| c["prev_ruby_baseline"] }.sort # optional
config_order += configs.select { |c| c["prod_ruby_no_jit"] }.sort
config_order += configs.select { |c| c["prod_ruby_with_mjit"] }.sort # MJIT is optional, may be empty
config_order += configs.select { |c| c["prev_ruby_yjit"] }.sort # optional
config_order += configs.select { |c| c["prod_ruby_with_yjit"] }.sort
Expand Down

0 comments on commit cd1f82d

Please sign in to comment.