use criterion::{black_box, criterion_group, criterion_main, Criterion};
use plotters_statistical::stats::{kde_curve, precision_recall_curve, roc_curve};
fn bench_kde(c: &mut Criterion) {
let data: Vec<f64> = (0..1000).map(|i| (i as f64 * 0.013).sin() * 3.0).collect();
c.bench_function("kde_1000pts_grid200", |b| {
b.iter(|| kde_curve(black_box(&data), None, 200, 3.0).unwrap())
});
}
fn bench_roc(c: &mut Criterion) {
let scores: Vec<f64> = (0..5000)
.map(|i| ((i as f64 * 12.9898).sin() * 43758.5453).rem_euclid(1.0))
.collect();
let labels: Vec<bool> = (0..5000).map(|i| i % 2 == 0).collect();
c.bench_function("roc_5000", |b| {
b.iter(|| roc_curve(black_box(&scores), black_box(&labels)).unwrap())
});
c.bench_function("pr_5000", |b| {
b.iter(|| precision_recall_curve(black_box(&scores), black_box(&labels)).unwrap())
});
}
criterion_group!(benches, bench_kde, bench_roc);
criterion_main!(benches);