From 41db7b49081aa50cb4d2cec3134e626b7f20062f Mon Sep 17 00:00:00 2001 From: Thomas Wright Date: Thu, 17 Oct 2024 14:10:48 +0200 Subject: [PATCH] Add test for constraint-based runtime --- benches/simple_add.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/benches/simple_add.rs b/benches/simple_add.rs index bb077cc..71ce38a 100644 --- a/benches/simple_add.rs +++ b/benches/simple_add.rs @@ -60,6 +60,21 @@ pub fn input_streams_typed(size: usize) -> BTreeMap { input_streams } +async fn monitor_outputs_untyped_constraints(num_outputs: usize) { + let input_streams = input_streams_concrete(num_outputs); + let spec = trustworthiness_checker::lola_specification(&mut spec_simple_add_monitor()).unwrap(); + let mut async_monitor = + trustworthiness_checker::constraint_based_runtime::ConstraintBasedMonitor::new( + spec, + input_streams, + ); + let _outputs: Vec> = async_monitor + .monitor_outputs() + .take(num_outputs) + .collect() + .await; +} + async fn monitor_outputs_untyped_async(num_outputs: usize) { let input_streams = input_streams_concrete(num_outputs); let spec = trustworthiness_checker::lola_specification(&mut spec_simple_add_monitor()).unwrap(); @@ -141,6 +156,14 @@ fn from_elem(c: &mut Criterion) { group.measurement_time(std::time::Duration::from_secs(30)); for size in sizes { + group.bench_with_input( + BenchmarkId::new("simple_add_constraints", size), + &size, + |b, &size| { + b.to_async(&tokio_rt) + .iter(|| monitor_outputs_untyped_constraints(size)) + }, + ); group.bench_with_input( BenchmarkId::new("simple_add_untyped_async", size), &size,