Skip to content

Commit c87ea25

Browse files
fix groups
1 parent d88bd5c commit c87ea25

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

crates/core/benches/function_parse.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,19 @@ fn benchmark_parallel_efficiency(c: &mut Criterion) {
9999
group.finish();
100100
}
101101

102-
fn benchmark_individual_files(c: &mut Criterion) {
102+
fn benchmark_per_filetype(c: &mut Criterion) {
103103
let cpus = num_cpus::get();
104-
let mut group = c.benchmark_group("Individual File Parsing");
105104

106-
// Set throughput to the number of CPUs
107-
group.throughput(Throughput::Elements(cpus as u64));
105+
// Create a group for base files
106+
let mut base_group = c.benchmark_group("Per Filetype Parsing, Base");
107+
base_group.throughput(Throughput::Elements(cpus as u64));
108108

109+
// Regular benchmarks with default sample size
109110
for &filename in TEST_FILESNAMES_BASE {
110111
let file = read_test_file(filename);
111112
let files: Vec<&[u8]> = vec![&file; cpus];
112113

113-
group.bench_function(filename, |b| {
114+
base_group.bench_function(filename, |b| {
114115
b.iter(|| {
115116
files
116117
.par_iter()
@@ -120,13 +121,18 @@ fn benchmark_individual_files(c: &mut Criterion) {
120121
});
121122
}
122123

124+
base_group.finish();
125+
126+
// Create a group for image files
127+
let mut image_group = c.benchmark_group("Per Filetype Parsing, Images");
128+
image_group.sample_size(10);
129+
image_group.throughput(Throughput::Elements(cpus as u64));
130+
123131
for &filename in TEST_FILESNAMES_IMAGES {
124132
let file = read_test_file(filename);
125133
let files: Vec<&[u8]> = vec![&file; cpus];
126134

127-
group.sample_size(10);
128-
129-
group.bench_function(filename, |b| {
135+
image_group.bench_function(filename, |b| {
130136
b.iter(|| {
131137
files
132138
.par_iter()
@@ -136,7 +142,7 @@ fn benchmark_individual_files(c: &mut Criterion) {
136142
});
137143
}
138144

139-
group.finish();
145+
image_group.finish();
140146
}
141147

142148
// Finds the threshold number of files for each type that takes less than 16ms
@@ -259,7 +265,7 @@ criterion_group!(
259265
benches,
260266
benchmark_sequential_vs_parallel,
261267
benchmark_parallel_efficiency,
262-
benchmark_individual_files,
268+
benchmark_per_filetype,
263269
benchmark_parallel_threshold
264270
);
265271
criterion_main!(benches);

0 commit comments

Comments
 (0)