Skip to content

Commit

Permalink
add microbenchmark code
Browse files Browse the repository at this point in the history
  • Loading branch information
shumbo committed Nov 7, 2023
1 parent 286dffa commit 45b0d10
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
12 changes: 4 additions & 8 deletions chorus_lib/benches/comm_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ use chorus_lib::core::{
ChoreoOp, Choreography, ChoreographyLocation, LocationSet, Projector, Transport,
};
use chorus_lib::transport::local::{LocalTransport, LocalTransportChannelBuilder};
use criterion::{
black_box, criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion,
PlotConfiguration,
};
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
use std::thread::spawn;

#[derive(ChoreographyLocation)]
Expand Down Expand Up @@ -96,14 +93,13 @@ fn comm_handwritten(n: u64) {

fn bench_comm(c: &mut Criterion) {
let mut group = c.benchmark_group("Comm");
let plot_config = PlotConfiguration::default().summary_scale(AxisScale::Logarithmic);
group.plot_config(plot_config);
for i in [1, 10, 100, 1000, 10000].iter() {
let range = [2000, 4000, 6000, 8000, 10000];
for i in range.iter() {
group.bench_with_input(BenchmarkId::new("Handwritten", i), i, |b, i| {
b.iter(|| comm_handwritten(black_box(*i)))
});
}
for i in [1, 10, 100, 1000, 10000].iter() {
for i in range.iter() {
group.bench_with_input(BenchmarkId::new("Choreographic", i), i, |b, i| {
b.iter(|| comm_choreography(black_box(*i)))
});
Expand Down
8 changes: 1 addition & 7 deletions chorus_lib/benches/locally_benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use chorus_lib::core::{ChoreoOp, Choreography, ChoreographyLocation, Located, LocationSet};
use criterion::{
black_box, criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion,
PlotConfiguration,
};
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};

#[derive(ChoreographyLocation)]
struct Alice;
Expand Down Expand Up @@ -43,9 +40,6 @@ fn add_to_n_locally_handwritten(n: f64) {

fn bench_add_to_n_locally(c: &mut Criterion) {
let mut group = c.benchmark_group("Locally");
let plot_config = PlotConfiguration::default().summary_scale(AxisScale::Logarithmic);
// group.plot_config(plot_config);
// let range = [1, 10, 100, 1000, 10000];
let range = [2000, 4000, 6000, 8000, 10000];
for i in range.iter() {
group.bench_with_input(BenchmarkId::new("Handwritten", i), i, |b, i| {
Expand Down

0 comments on commit 45b0d10

Please sign in to comment.