//! Benchmark for the Stage 5 schedule/module overhead.
//!
//! Stage 5 criterion: module/system scheduling overhead must be negligible
//! compared to the Stage-4 hardcoded loop. There is no per-frame work here — the
//! benchmark measures the *frame overhead itself*: advancing timing, walking the
//! phase lists, and the fixed-timestep accumulator, with a realistic handful of
//! empty systems registered. Check that `app_empty_update` is in the low
//! nanoseconds (i.e. lost in the noise next to any real system's work).

use criterion::{black_box, criterion_group, criterion_main, Criterion};
use oxide_engine::app::{App, Schedule};

fn empty_update(c: &mut Criterion) {
    let mut app = App::new();
    // A few no-op systems spread across phases, as a trivial game might have.
    for _ in 0..4 {
        app.add_system(Schedule::Update, |_| {});
    }
    app.add_system(Schedule::FixedUpdate, |_| {});
    app.add_system(Schedule::Render, |_| {});

    c.bench_function("app_empty_update", |bencher| {
        bencher.iter(|| {
            app.update(black_box(1.0 / 60.0));
            black_box(app.time.frame)
        });
    });
}

criterion_group!(benches, empty_update);
criterion_main!(benches);
