Skip to content

Commit f59d1eb

Browse files
committed
Extract methods to build columns
1 parent 145f8ec commit f59d1eb

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

lib/results_table_builder.rb

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,27 @@ def build_row(bench_name)
7777
ratio_1sts = other_t0s.map { |other_t0| base_t0 / other_t0 }
7878
ratios = other_ts.map { |other_t| mean(base_t) / mean(other_t) }
7979

80-
row = [bench_name, mean(base_t), 100 * stddev(base_t) / mean(base_t)]
80+
row = [bench_name]
81+
build_base_columns(row, base_t, base_rss)
82+
build_comparison_columns(row, other_ts, other_rsss)
83+
row.concat(ratio_1sts)
84+
row.concat(ratios)
85+
86+
row
87+
end
88+
89+
def build_base_columns(row, base_t, base_rss)
90+
row << mean(base_t)
91+
row << 100 * stddev(base_t) / mean(base_t)
8192
row << base_rss if @include_rss
93+
end
8294

95+
def build_comparison_columns(row, other_ts, other_rsss)
8396
other_ts.zip(other_rsss).each do |other_t, other_rss|
84-
row += [mean(other_t), 100 * stddev(other_t) / mean(other_t)]
97+
row << mean(other_t)
98+
row << 100 * stddev(other_t) / mean(other_t)
8599
row << other_rss if @include_rss
86100
end
87-
88-
row += ratio_1sts + ratios
89-
90-
row
91101
end
92102

93103
def extract_first_iteration_times(bench_name)

0 commit comments

Comments
 (0)