Skip to content

Commit 18384bc

Browse files
committed
Give meaning to the category checking
1 parent 97cf092 commit 18384bc

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

lib/benchmark_suite.rb

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class BenchmarkSuite
1515
BENCHMARKS_DIR = "benchmarks"
1616
RACTOR_BENCHMARKS_DIR = "benchmarks-ractor"
1717
RACTOR_ONLY_CATEGORY = ["ractor-only"].freeze
18-
RACTOR_CATEGORY = "ractor"
18+
RACTOR_CATEGORY = ["ractor"].freeze
1919
RACTOR_HARNESS = "harness-ractor"
2020

2121
attr_reader :ruby, :ruby_description, :categories, :name_filters, :out_path, :harness, :pre_init, :no_pinning, :bench_dir, :ractor_bench_dir
@@ -130,7 +130,7 @@ def bench_file_grouping
130130
filter = benchmark_filter(categories: categories, name_filters: name_filters)
131131
bench_file_grouping[bench_dir] = filtered_bench_entries(bench_dir, filter)
132132

133-
if categories == [RACTOR_CATEGORY]
133+
if benchmark_ractor_directory?
134134
# We ignore the category filter here because everything in the
135135
# benchmarks-ractor directory should be included when we're benchmarking the
136136
# Ractor category
@@ -141,12 +141,6 @@ def bench_file_grouping
141141
bench_file_grouping
142142
end
143143

144-
def filtered_bench_entries(dir, filter)
145-
Dir.children(dir).sort.filter do |entry|
146-
filter.match?(entry)
147-
end
148-
end
149-
150144
def benchmark_filter(categories:, name_filters:)
151145
@benchmark_filter ||= {}
152146
key = [categories, name_filters]
@@ -161,6 +155,16 @@ def benchmarks_metadata
161155
@benchmarks_metadata ||= YAML.load_file('benchmarks.yml')
162156
end
163157

158+
def filtered_bench_entries(dir, filter)
159+
Dir.children(dir).sort.filter do |entry|
160+
filter.match?(entry)
161+
end
162+
end
163+
164+
def benchmark_ractor_directory?
165+
categories == RACTOR_CATEGORY
166+
end
167+
164168
# Check if running on Linux
165169
def linux?
166170
RbConfig::CONFIG['host_os'] =~ /linux/

0 commit comments

Comments
 (0)