# Performance Benchmarks

MoonRule separates compilation from evaluation. Benchmarks therefore construct and compile programs outside the measured closure, reflecting the recommended service integration pattern.

Run only the project benchmarks with:

```text
moon bench --package YeeHh2004/moonrule
```

Reference result on 2026-07-27 using MoonBit 0.10.4 on the development machine:

| Workload | Mean time |
|---|---:|
| One compiled access rule | 266.52 ns |
| Six-rule API policy | 1.41 µs |
| Four regression cases against two rules | 2.22 µs |

These figures are a reproducible engineering snapshot, not a cross-machine guarantee. Compiler version, backend, CPU, power policy, and input shape affect results. Each benchmark reports distribution and run count through MoonBit's official benchmark harness.

The benchmark source is intentionally small and reviewable in `evaluator_bench.mbt`. It uses `bench.keep` to retain evaluated reports and prevent dead-code elimination.
