Performance Benchmark

August 14, 2026 ยท View on GitHub

The benchmark is deterministic, local, and does not read the user's memory database or call a model. Each of three runs creates 1,001 synthetic claims and executes 300 mixed Chinese/English queries after warm-up. The report uses the median metric across the three runs and also records the maximum observed p95.

Run it with:

npm run benchmark

The script measures both an in-memory SQLite database and a temporary database on the WSL filesystem. The pass threshold is 25 ms p95 for the complete recall path, including trigger search, capsule merge, CBDC decisions, and audit writes.

Representative Result

Environment: WSL, Node.js 22.22.1, 2026-08-14.

Storage/pathmeanp50p95p99
v1 baseline trigger search, memory2.445 ms2.151 ms3.657 ms4.076 ms
v1.1 trigger search, memory4.097 ms3.907 ms5.198 ms5.669 ms
v1.1 full recall + audit, memory4.126 ms3.885 ms5.478 ms5.972 ms
v1.1 trigger search, WSL disk4.208 ms4.015 ms5.343 ms5.859 ms
v1.1 full recall + audit, WSL disk8.801 ms8.512 ms11.151 ms13.701 ms

The maximum observed WSL-disk full-recall p95 across the three runs was 11.663 ms. Both quality probes passed: a lightweight Chinese synonym query found the expected memory, and an unrelated query still received the trusted global preference through the bounded memory capsule.

Interpretation

Dual-channel matching adds about 2 ms p95 to the in-memory trigger search in this workload. The realistic WSL-disk full path remains around 11 ms p95, far smaller than normal model latency. Results vary by hardware and filesystem, so the checked-in script is the source of truth rather than this single run.