Knocked down benchmark length

This commit is contained in:
Dave Hrycyszyn
2024-06-18 12:25:07 +01:00
parent 48a83fcd55
commit fbf547ce0e

View File

@@ -4,23 +4,23 @@ use bft_json_crdt::{
use criterion::{criterion_group, criterion_main, Criterion};
use rand::seq::SliceRandom;
fn bench_insert_1_000_root(c: &mut Criterion) {
c.bench_function("bench insert 1000 root", |b| {
fn bench_insert_100_root(c: &mut Criterion) {
c.bench_function("bench insert 100 root", |b| {
b.iter(|| {
let mut list = ListCrdt::<i64>::new(make_author(1), vec![]);
for i in 0..1_000 {
for i in 0..100 {
list.insert(ROOT_ID, i);
}
})
});
}
fn bench_insert_1_000_linear(c: &mut Criterion) {
c.bench_function("bench insert 1000 linear", |b| {
fn bench_insert_100_linear(c: &mut Criterion) {
c.bench_function("bench insert 100 linear", |b| {
b.iter(|| {
let mut list = ListCrdt::<i64>::new(make_author(1), vec![]);
let mut prev = ROOT_ID;
for i in 0..1_000 {
for i in 0..100 {
let op = list.insert(prev, i);
prev = op.id;
}
@@ -31,7 +31,7 @@ fn bench_insert_1_000_linear(c: &mut Criterion) {
fn bench_insert_many_agents_conflicts(c: &mut Criterion) {
c.bench_function("bench insert many agents conflicts", |b| {
b.iter(|| {
const N: u8 = 50;
const N: u8 = 10;
let mut rng = rand::thread_rng();
let mut crdts: Vec<ListCrdt<i64>> = Vec::with_capacity(N as usize);
let mut logs: Vec<Op<JsonValue>> = Vec::new();
@@ -60,8 +60,8 @@ fn bench_insert_many_agents_conflicts(c: &mut Criterion) {
criterion_group!(
benches,
bench_insert_1_000_root,
bench_insert_1_000_linear,
bench_insert_100_root,
bench_insert_100_linear,
bench_insert_many_agents_conflicts
);
criterion_main!(benches);