Skip to content

Commit

Permalink
test(insert): more realistic payload
Browse files Browse the repository at this point in the history
  • Loading branch information
loyd committed Dec 7, 2023
1 parent d930b66 commit 2f87d21
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions benches/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,33 @@ struct SomeRow {
b: i64,
c: i32,
d: u32,
e: u64,
f: u32,
g: u64,
h: i64,
}

impl SomeRow {
fn sample() -> Self {
black_box(Self {
a: 42,
b: 42,
c: 42,
d: 42,
e: 42,
f: 42,
g: 42,
h: 42,
})
}
}

async fn run_insert(client: Client, iters: u64) -> Result<Duration> {
let start = Instant::now();
let mut insert = client.insert("table")?;

for _ in 0..iters {
insert
.write(&black_box(SomeRow {
a: 42,
b: 42,
c: 42,
d: 42,
}))
.await?;
insert.write(&SomeRow::sample()).await?;
}

insert.end().await?;
Expand All @@ -76,12 +88,7 @@ async fn run_inserter<const WITH_PERIOD: bool>(client: Client, iters: u64) -> Re
}

for _ in 0..iters {
inserter.write(&black_box(SomeRow {
a: 42,
b: 42,
c: 42,
d: 42,
}))?;
inserter.write(&SomeRow::sample())?;
inserter.commit().await?;
}

Expand Down

0 comments on commit 2f87d21

Please sign in to comment.