Skip to content

Commit ab2f6da

Browse files
committed
Extract method to build the ratio columns
1 parent f59d1eb commit ab2f6da

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/results_table_builder.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,10 @@ def build_row(bench_name)
7474
base_t, *other_ts = times_no_warmup
7575
base_rss, *other_rsss = rsss
7676

77-
ratio_1sts = other_t0s.map { |other_t0| base_t0 / other_t0 }
78-
ratios = other_ts.map { |other_t| mean(base_t) / mean(other_t) }
79-
8077
row = [bench_name]
8178
build_base_columns(row, base_t, base_rss)
8279
build_comparison_columns(row, other_ts, other_rsss)
83-
row.concat(ratio_1sts)
84-
row.concat(ratios)
80+
build_ratio_columns(row, base_t0, other_t0s, base_t, other_ts)
8581

8682
row
8783
end
@@ -100,6 +96,13 @@ def build_comparison_columns(row, other_ts, other_rsss)
10096
end
10197
end
10298

99+
def build_ratio_columns(row, base_t0, other_t0s, base_t, other_ts)
100+
ratio_1sts = other_t0s.map { |other_t0| base_t0 / other_t0 }
101+
ratios = other_ts.map { |other_t| mean(base_t) / mean(other_t) }
102+
row.concat(ratio_1sts)
103+
row.concat(ratios)
104+
end
105+
103106
def extract_first_iteration_times(bench_name)
104107
@executable_names.map do |name|
105108
data = bench_data_for(name, bench_name)

0 commit comments

Comments
 (0)