# Reproducible benchmark

The executable contains a fixed optical workload so that changes to the numerical pipeline can be compared without changing the input stack:

- DBR stack: 10 high/low-index pairs, center wavelength 632.8 nm.
- Spectrum sweep: 400–800 nm, 100 intervals, 101 samples.
- Workflow benchmark: 3 repeats × 41 samples over 500–700 nm.
- Thickness optimization: one bounded parameter, 7 evaluations in the current run.
- Tolerance simulation: 100 deterministic trials.

## Run the workload

```bash
moon fmt --check
moon check --deny-warn --target all
moon run src/main
```

To measure wall-clock time, keep timing outside the MoonBit program. On PowerShell:

```powershell
$times = @()
1..5 | ForEach-Object {
  $t = Measure-Command { moon run src/main | Out-Null }
  $times += [math]::Round($t.TotalMilliseconds, 2)
}
$times -join ', '
```

On a Unix shell, use `/usr/bin/time -p moon run src/main` for each repetition. Record the operating system, MoonBit version, CPU and whether the build cache was warm when comparing results.

## Local measurement

Captured on 2026-08-23 with MoonBit `0.1.20260814` / Moonc `0.10.8+8606a5800` on the local Windows development machine. The CPU identifier was `Intel64 Family 6 Model 186 Stepping 2, GenuineIntel`, Windows reported version `10.0.26200.0`, and the MoonBit build cache was warm after the verification run:

| Metric | Result |
| --- | ---: |
| CLI run 1–5 | 160.99, 184.49, 189.68, 172.26, 155.15 ms |
| Arithmetic mean | 172.51 ms |
| Minimum / maximum | 155.15 / 189.68 ms |
| Workflow samples | 3 × 41 |
| Workflow checksum | 74450.96259366864 |
| Quality gates | 5 passed, 0 failed |
| Maximum energy-balance error | 3.774758283725532e-15 |
| Monte Carlo trials | 100 |
| CPU identifier | Intel64 Family 6 Model 186 Stepping 2 |
| Windows version | 10.0.26200.0 |
| Build cache | warm |

The timing is a local reference point rather than a portability guarantee. The checksum and sample counters are the more stable regression signals.
