Skip to content

Commit 2f37643

Browse files
committed
Extract constants to explain the convertions
1 parent ab2f6da commit 2f37643

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/results_table_builder.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
require_relative '../misc/stats'
22

33
class ResultsTableBuilder
4+
SECONDS_TO_MS = 1000.0
5+
BYTES_TO_MIB = 1024.0 * 1024.0
6+
47
def initialize(executable_names:, bench_data:, bench_names:, include_rss: false)
58
@executable_names = executable_names
69
@bench_data = bench_data
@@ -106,19 +109,19 @@ def build_ratio_columns(row, base_t0, other_t0s, base_t, other_ts)
106109
def extract_first_iteration_times(bench_name)
107110
@executable_names.map do |name|
108111
data = bench_data_for(name, bench_name)
109-
(data['warmup'][0] || data['bench'][0]) * 1000.0
112+
(data['warmup'][0] || data['bench'][0]) * SECONDS_TO_MS
110113
end
111114
end
112115

113116
def extract_benchmark_times(bench_name)
114117
@executable_names.map do |name|
115-
bench_data_for(name, bench_name)['bench'].map { |v| v * 1000.0 }
118+
bench_data_for(name, bench_name)['bench'].map { |v| v * SECONDS_TO_MS }
116119
end
117120
end
118121

119122
def extract_rss_values(bench_name)
120123
@executable_names.map do |name|
121-
bench_data_for(name, bench_name)['rss'] / 1024.0 / 1024.0
124+
bench_data_for(name, bench_name)['rss'] / BYTES_TO_MIB
122125
end
123126
end
124127

0 commit comments

Comments
 (0)