core/utils/performance_budget library

Pure-Dart performance budget / regression-check framework (FEAT-80).

Consumes already-measured PerformanceBudgetMetrics — produced by tool/performance_budget_check.dart from a real headless benchmark and/or a real-device smoke-test run, never fabricated here — and checks them against a BudgetPolicy list, optionally comparing against a committed PerformanceBudgetMetric baseline for regression detection. No I/O, no Flutter dependency.

Honesty rules baked into checkPerformanceBudgets:

Classes

BudgetPolicy
One budget rule a named metric must satisfy.
PerformanceBudgetMetric
One measured value — e.g. an allocation-reduction percentage from tool/object_pool_benchmark.dart, or a real-device app-boot wall time.
PerformanceBudgetResult
PerformanceBudgetViolation

Enums

BudgetDirection
Whether a budget's BudgetPolicy.limit is a ceiling or a floor.
MeasurementSource
Where a PerformanceBudgetMetric's value actually came from.
PerformanceBudgetViolationKind

Functions

checkPerformanceBudgets({required List<PerformanceBudgetMetric> measurements, required List<BudgetPolicy> policies, List<PerformanceBudgetMetric> baseline = const [], int? nowMs}) → PerformanceBudgetResult
Checks measurements against policies. Each policy fails on at most one PerformanceBudgetViolation (checked in the order: missing, wrong source, stale, over budget, regression) — stops at the first that applies rather than piling up redundant complaints about one metric.