|
1 |
| -//! Benchmarking for syncing functions |
2 |
| -use crate::tracing::Instrument; |
3 |
| -use criterion::{criterion_group, criterion_main, BatchSize, Criterion}; |
4 |
| -use tokio::runtime::{Builder, Runtime}; |
5 |
| -use xmtp_mls::utils::bench::{bench_async_setup, BENCH_ROOT_SPAN}; |
6 |
| -use xmtp_mls::utils::bench::{clients, init_logging}; |
| 1 | +// //! Benchmarking for syncing functions |
| 2 | +// use crate::tracing::Instrument; |
| 3 | +// use criterion::{criterion_group, criterion_main, BatchSize, Criterion}; |
| 4 | +// use tokio::runtime::{Builder, Runtime}; |
| 5 | +// use xmtp_mls::utils::bench::{bench_async_setup, BENCH_ROOT_SPAN}; |
| 6 | +// use xmtp_mls::utils::bench::{clients, init_logging}; |
| 7 | +// |
| 8 | +// #[macro_use] |
| 9 | +// extern crate tracing; |
| 10 | +// |
| 11 | +// fn setup() -> Runtime { |
| 12 | +// Builder::new_multi_thread() |
| 13 | +// .enable_time() |
| 14 | +// .enable_io() |
| 15 | +// .thread_name("xmtp-bencher") |
| 16 | +// .build() |
| 17 | +// .unwrap() |
| 18 | +// } |
| 19 | +// |
| 20 | +// fn start_sync_worker(c: &mut Criterion) { |
| 21 | +// init_logging(); |
| 22 | +// |
| 23 | +// let runtime = setup(); |
| 24 | +// let mut benchmark_group = c.benchmark_group("start_sync_worker"); |
| 25 | +// benchmark_group.sample_size(10); |
| 26 | +// benchmark_group.bench_function("start_sync_worker", |b| { |
| 27 | +// let span = trace_span!(BENCH_ROOT_SPAN); |
| 28 | +// b.to_async(&runtime).iter_batched( |
| 29 | +// || { |
| 30 | +// bench_async_setup(|| async { |
| 31 | +// let client = clients::new_client(true).await; |
| 32 | +// // set history sync URL |
| 33 | +// (client, span.clone()) |
| 34 | +// }) |
| 35 | +// }, |
| 36 | +// |(client, span)| async move { client.start_sync_worker().instrument(span) }, |
| 37 | +// BatchSize::SmallInput, |
| 38 | +// ) |
| 39 | +// }); |
| 40 | +// |
| 41 | +// benchmark_group.finish(); |
| 42 | +// } |
7 | 43 |
|
8 |
| -#[macro_use] |
9 |
| -extern crate tracing; |
10 |
| - |
11 |
| -fn setup() -> Runtime { |
12 |
| - Builder::new_multi_thread() |
13 |
| - .enable_time() |
14 |
| - .enable_io() |
15 |
| - .thread_name("xmtp-bencher") |
16 |
| - .build() |
17 |
| - .unwrap() |
18 |
| -} |
19 |
| - |
20 |
| -fn start_sync_worker(c: &mut Criterion) { |
21 |
| - init_logging(); |
22 |
| - |
23 |
| - let runtime = setup(); |
24 |
| - let mut benchmark_group = c.benchmark_group("start_sync_worker"); |
25 |
| - benchmark_group.sample_size(10); |
26 |
| - benchmark_group.bench_function("start_sync_worker", |b| { |
27 |
| - let span = trace_span!(BENCH_ROOT_SPAN); |
28 |
| - b.to_async(&runtime).iter_batched( |
29 |
| - || { |
30 |
| - bench_async_setup(|| async { |
31 |
| - let client = clients::new_client(true).await; |
32 |
| - // set history sync URL |
33 |
| - (client, span.clone()) |
34 |
| - }) |
35 |
| - }, |
36 |
| - |(client, span)| async move { |
37 |
| - client |
38 |
| - .start_sync_worker() |
39 |
| - .instrument(span) |
40 |
| - .await |
41 |
| - .unwrap() |
42 |
| - }, |
43 |
| - BatchSize::SmallInput, |
44 |
| - ) |
45 |
| - }); |
46 |
| - |
47 |
| - benchmark_group.finish(); |
48 |
| -} |
49 |
| - |
50 |
| -criterion_group!( |
51 |
| - name = sync; |
52 |
| - config = Criterion::default().sample_size(10); |
53 |
| - targets = start_sync_worker |
54 |
| -); |
55 |
| -criterion_main!(sync); |
| 44 | +// criterion_group!( |
| 45 | +// name = sync; |
| 46 | +// config = Criterion::default().sample_size(10); |
| 47 | +// targets = start_sync_worker |
| 48 | +// ); |
| 49 | +// criterion_main!(sync); |
0 commit comments