Files
Entropyk/crates/solver/benches/residual_jacobian_assembly.rs
sepehr 5bd180b5b8
Some checks failed
CI / check (push) Has been cancelled
Snapshot WIP: solver HP epic progress, BPHX/HX physics, BMAD skill refresh.
Capture uncommitted solver robustness work (regularization, domain errors, linear solver lifecycle, tube DP/MSH), web workbench updates, and synced BMAD skills across IDE agent folders before starting BPHX pressure-drop.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 16:35:31 +02:00

41 lines
1.4 KiB
Rust

//! Phase-0 benchmark: residual + Jacobian assembly pass over the full system.
//!
//! Measures the cost of evaluating all component residuals and analytical
//! Jacobian entries once — the per-Newton-iteration work that dominates solver
//! runtime for real cycles.
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use entropyk_components::JacobianBuilder;
use entropyk_components::ResidualVector;
mod common;
fn bench_residual_assembly(c: &mut Criterion) {
let (system, state) = common::build_mock_system();
let mut residuals = ResidualVector::with_capacity(system.full_state_vector_len());
c.bench_function("residual_assembly_mock", |b| {
b.iter(|| {
residuals.clear();
residuals.resize(system.full_state_vector_len(), 0.0);
let _: () = system.compute_residuals(&state, &mut residuals).unwrap();
black_box(());
});
});
}
fn bench_jacobian_assembly(c: &mut Criterion) {
let (system, state) = common::build_mock_system();
c.bench_function("jacobian_assembly_mock", |b| {
b.iter(|| {
let mut builder = JacobianBuilder::new();
let _: () = system.assemble_jacobian(&state, &mut builder).unwrap();
black_box(());
});
});
}
criterion_group!(benches, bench_residual_assembly, bench_jacobian_assembly);
criterion_main!(benches);