Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bench: Only output throughput if BYTES is set #56

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,12 @@ fn vec_u_vn_s_copy_flat_region_column(bencher: &mut Bencher) {
);
}

fn set_bytes(target: &mut u64, bytes: usize) {
if std::env::var("BYTES").is_ok() {
*target = bytes as u64;
}
}

fn _bench_copy<T: RegionPreference + Eq>(bencher: &mut Bencher, record: T)
where
for<'a> <T as RegionPreference>::Region: Push<&'a T>,
Expand All @@ -399,8 +405,7 @@ where
siz += this_siz;
cap += this_cap
});
bencher.bytes = siz as u64;
println!("{siz} {cap}");
set_bytes(&mut bencher.bytes, siz);
}

fn _bench_copy_region<R: Region, T>(bencher: &mut Bencher, record: T)
Expand All @@ -421,8 +426,7 @@ where
siz += this_siz;
cap += this_cap
});
bencher.bytes = siz as u64;
println!("{siz} {cap}");
set_bytes(&mut bencher.bytes, siz);
}

fn _bench_clone<T: RegionPreference + Eq + Clone>(bencher: &mut Bencher, record: T) {
Expand Down Expand Up @@ -454,7 +458,6 @@ where
siz += this_siz;
cap += this_cap
});
bencher.bytes = siz as u64;
}

fn _bench_prealloc<T: RegionPreference + Eq>(bencher: &mut Bencher, record: T)
Expand All @@ -475,7 +478,7 @@ where
siz += this_siz;
cap += this_cap
});
bencher.bytes = siz as u64;
set_bytes(&mut bencher.bytes, siz);
}

fn _bench_copy_flat_preference<T>(bencher: &mut Bencher, record: T)
Expand Down Expand Up @@ -506,6 +509,5 @@ where
siz += this_siz;
cap += this_cap
});
bencher.bytes = siz as u64;
println!("{siz} {cap}");
set_bytes(&mut bencher.bytes, siz);
}