reasonkit-core 0.1.8

The Reasoning Engine — Auditable Reasoning for Production AI | Rust-Native | Turn Prompts into Protocols
use criterion::{criterion_group, criterion_main, Criterion};
use reasonkit::thinktool::modules::{GigaThink, ThinkToolContext, ThinkToolModule};
use reasonkit::thinktool::{ExecutorConfig, ProtocolExecutor, ProtocolInput};
use tokio::runtime::Runtime;

fn bench_mock_execution(c: &mut Criterion) {
    let rt = Runtime::new().unwrap();
    let executor = ProtocolExecutor::mock().unwrap();
    let input = ProtocolInput::query("Benchmarking query");

    c.bench_function("execute_quick_profile_mock", |b| {
        b.to_async(&rt).iter(|| async {
            executor
                .execute_profile("quick", input.clone())
                .await
                .unwrap();
        })
    });
}

fn bench_parallel_execution(c: &mut Criterion) {
    let rt = Runtime::new().unwrap();
    let config = ExecutorConfig::mock().with_parallel();
    let executor = ProtocolExecutor::with_config(config).unwrap();
    let input = ProtocolInput::query("Parallel benchmark");

    c.bench_function("execute_gigathink_parallel_mock", |b| {
        b.to_async(&rt).iter(|| async {
            executor.execute("gigathink", input.clone()).await.unwrap();
        })
    });
}

fn bench_gigathink_generation(c: &mut Criterion) {
    let module = GigaThink::new();
    let context = ThinkToolContext::new("Benchmarking query for parallel generation");

    c.bench_function("gigathink_direct_execute", |b| {
        b.iter(|| {
            module.execute(&context).unwrap();
        })
    });
}

criterion_group!(
    benches,
    bench_mock_execution,
    bench_parallel_execution,
    bench_gigathink_generation
);
criterion_main!(benches);