Skip to content

Commit

Permalink
Merge pull request #253 from Shopify/rwstauner/version-from-meta
Browse files Browse the repository at this point in the history
Get ruby version for graph label from metadata
  • Loading branch information
rwstauner committed May 21, 2024
2 parents b20615e + f5d76d1 commit f77fa63
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
10 changes: 10 additions & 0 deletions lib/yjit-metrics/bench-results.rb
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,16 @@ def metadata_for_config(config)
@ruby_metadata[config]
end

def ruby_version_for_config(config)
return unless metadata = @ruby_metadata[config]

if (match = metadata["RUBY_DESCRIPTION"]&.match(/^(?:ruby\s+)?([0-9.]+\S*)/))
match[1]
else
metadata["RUBY_VERSION"]
end
end

# What Ruby configurations does this ResultSet contain data for?
def available_configs
@ruby_metadata.keys
Expand Down
19 changes: 10 additions & 9 deletions lib/yjit-metrics/report_types/bloggable_speed_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ 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],
]
# TODO: get the ruby version from the description in the metadata
@configs_with_human_names.push(["MJIT3.0", @with_mjit30_config]) if @with_mjit30_config
@configs_with_human_names.push(["MJIT", @with_mjit_latest_config]) if @with_mjit_latest_config
@configs_with_human_names.push(["YJIT 3.3", @with_prev_yjit_config]) if @with_prev_yjit_config
@configs_with_human_names.push(["YJIT 3.4dev", @with_yjit_config])
@configs_with_human_names.push(["Truffle", @truffle_config]) if @truffle_config
["No JIT", @no_jit_config],
["MJIT3.0", @with_mjit30_config],
["MJIT", @with_mjit_latest_config],
["YJIT <version>", @with_prev_yjit_config],
["YJIT <version>", @with_yjit_config],
["Truffle", @truffle_config],
].map do |(name, config)|
[name.sub(/<version>/, @result_set.ruby_version_for_config(config)), config] if config
end.compact

# Grab relevant data from the ResultSet
@times_by_config = {}
Expand Down Expand Up @@ -430,7 +431,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.08
top_legend_box_width = 0.1
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

0 comments on commit f77fa63

Please sign in to comment.