T0 + T1 + T2: engine redesign through new API surface #1

Merged
logaritmisk merged 45 commits from t2-new-api-surface into main 2026-04-24 11:20:04 +00:00
3 changed files with 18 additions and 3 deletions
Showing only changes of commit 06d3c886fe - Show all commits

12
benches/baseline.txt Normal file
View File

@@ -0,0 +1,12 @@
# Baseline numbers captured before T0 changes
# Hardware: lrrr.local / Apple M5 Pro
# Date: 2026-04-24
Batch::iteration 29.840 µs
Gaussian::add 219.58 ps
Gaussian::sub 219.41 ps
Gaussian::mul 1.568 ns
Gaussian::div 1.572 ns
Gaussian::pi 262.89 ps
Gaussian::tau 262.47 ps
Gaussian::pi_tau_combined 219.40 ps

View File

@@ -23,8 +23,11 @@ fn benchmark_gaussian_arithmetic(criterion: &mut Criterion) {
}); });
// Benchmark division // Benchmark division
// NOTE: numerator must have higher precision (smaller sigma) than the
// denominator in this representation; g2 (sigma=1) / g1 (sigma=8.33) is
// well-defined, whereas g1 / g2 underflows and panics in mu_sigma.
criterion.bench_function("Gaussian::div", |bencher| { criterion.bench_function("Gaussian::div", |bencher| {
bencher.iter(|| g1 / g2); bencher.iter(|| g2 / g1);
}); });
// Benchmark natural parameter conversions // Benchmark natural parameter conversions

View File

@@ -13,7 +13,7 @@ impl Gaussian {
Gaussian { mu, sigma } Gaussian { mu, sigma }
} }
fn pi(&self) -> f64 { pub fn pi(&self) -> f64 {
if self.sigma > 0.0 { if self.sigma > 0.0 {
self.sigma.powi(-2) self.sigma.powi(-2)
} else { } else {
@@ -21,7 +21,7 @@ impl Gaussian {
} }
} }
fn tau(&self) -> f64 { pub fn tau(&self) -> f64 {
if self.sigma > 0.0 { if self.sigma > 0.0 {
self.mu * self.pi() self.mu * self.pi()
} else { } else {