Dependencies
Summary
The current benches/exact.rs benchmarks use a single fixed well-conditioned matrix per dimension. This measures typical-case performance but misses important input classes where exact arithmetic performance varies significantly.
Current State
Each dimension (D=2–5) benchmarks one diagonally dominant matrix with small entries (matrix_entry produces values near D+1 on the diagonal, small off-diagonal). The only exception is near_singular_3x3, which benchmarks det_sign_exact and det_exact but not solve_exact.
This is methodologically sound for reproducibility but leaves gaps:
- No near-singular solve benchmarks (the primary use case for exact solve)
- No inputs that stress BigInt intermediate value growth
- No variance measurement across different input structures
Proposed Changes
1. Near-singular solve benchmarks
Add solve_exact and solve_exact_f64 benchmarks for near-singular matrices (at least D=3). These are the inputs where exact solve matters most and where intermediate values grow largest.
2. Adversarial BigInt growth inputs
Add a matrix with large entries (e.g. entries near f64::MAX / 2) that maximizes intermediate BigInt bit-lengths during Bareiss/Gauss elimination. This stress-tests the allocator and big-integer multiply.
3. Random-input percentile benchmarks (optional)
Consider adding a benchmark group that runs N random matrices per dimension and reports median/p95/p99. This captures variance from branch misprediction, allocation patterns, and intermediate value sizes that a single fixed input misses.
4. Ill-conditioned matrix benchmarks
Add a Hilbert-like or Vandermonde matrix where entries span many orders of magnitude. This exercises different exponent-scaling behavior in the f64_decompose → BigInt path.
Benefits
- More representative performance characterization for the exact arithmetic use case (geometric predicates on near-degenerate configurations)
- Better detection of performance regressions on adversarial inputs
- Stronger empirical evidence for
docs/PERFORMANCE.md
Implementation Notes
Dependencies
Summary
The current
benches/exact.rsbenchmarks use a single fixed well-conditioned matrix per dimension. This measures typical-case performance but misses important input classes where exact arithmetic performance varies significantly.Current State
Each dimension (D=2–5) benchmarks one diagonally dominant matrix with small entries (
matrix_entryproduces values nearD+1on the diagonal, small off-diagonal). The only exception isnear_singular_3x3, which benchmarksdet_sign_exactanddet_exactbut notsolve_exact.This is methodologically sound for reproducibility but leaves gaps:
Proposed Changes
1. Near-singular solve benchmarks
Add
solve_exactandsolve_exact_f64benchmarks for near-singular matrices (at least D=3). These are the inputs where exact solve matters most and where intermediate values grow largest.2. Adversarial BigInt growth inputs
Add a matrix with large entries (e.g. entries near
f64::MAX / 2) that maximizes intermediateBigIntbit-lengths during Bareiss/Gauss elimination. This stress-tests the allocator and big-integer multiply.3. Random-input percentile benchmarks (optional)
Consider adding a benchmark group that runs N random matrices per dimension and reports median/p95/p99. This captures variance from branch misprediction, allocation patterns, and intermediate value sizes that a single fixed input misses.
4. Ill-conditioned matrix benchmarks
Add a Hilbert-like or Vandermonde matrix where entries span many orders of magnitude. This exercises different exponent-scaling behavior in the
f64_decompose→BigIntpath.Benefits
docs/PERFORMANCE.mdImplementation Notes
solve_exactbenchmark can reuse or adaptnear_singular_3x3()