# JavaScript Timer accuracy benchmark v1 methodology

## Frozen protocol

- Cadence: 100 ms
- Nominal duration: 4000 ms
- Trials: 1 warm-up and 10 measured runs per scenario
- Scenarios: foreground idle; 280 ms stalls at 800/1600/2400/3200 ms; one 900 ms stall at 3600 ms crossing the deadline
- Exclusion threshold: wall-versus-monotonic offset jump above 50 ms
- Go/No-Go: at least 8 valid measured trials per scenario, unique trial identities, complete observations, and fixed-decrement trial-max absolute remaining error median more than 50 ms above the wall-deadline median in both stall scenarios.

## Paired observation

Every interval callback reads one `Date.now()` value and one `performance.now()` value. Fixed decrement, `deadline - Date.now()`, and the monotonic reference are calculated from that same pair. Deliberate busy loops are separate main-thread tasks, and actual start/end times are retained in `exclusions.csv`.

## Metrics

- callback lateness: monotonic callback elapsed time minus its nominal callback-index schedule.
- remaining-time error: each algorithm's remaining value minus the monotonic remaining reference.
- completion-detection lateness: the first callback observing zero minus the monotonic deadline.

Summaries use minimum, median, p95 and maximum. Quantiles use linear interpolation over sorted values. No significance test or cross-environment inference is made.

## Environment

Chrome/151.0.7922.108; macOS 26.5.1 (25F80); Mac17,4
