Files
Matt Kane fbed118b23 chore(scripts): commit perf query-dump tooling (#868)
Adds the query-dump harness and analysis scripts that produced the
catalogue used to drive PRs #838, #839, #840:

- scripts/query-counts-dump.mjs — sibling of query-counts.mjs that
  emits per-route × phase NDJSON dumps under scripts/query-dumps/.
- scripts/build-perf-d1.mjs — standalone "build the perf fixture for
  d1" wrapper, useful when iterating with the dump harness without
  re-running the full counts harness.
- scripts/query-dumps/{classify,cold-only,inspect-other}.mjs — analysis
  helpers for slicing the dumps. classify.mjs writes a markdown
  classification report; cold-only.mjs surfaces the d1 cold-isolate tax;
  inspect-other.mjs prints distinct SQL for a class.
- scripts/query-dumps/README.md — workflow doc.

The dump JSON itself and the generated classification.{target}.md
reports stay gitignored — they're analysis artefacts that regenerate
from the harness in seconds. The query-dumps analysis scripts are
excluded from oxlint (one-off tooling, not production code).
2026-04-30 20:17:10 +01:00
..

Query dumps for the perf fixture

Tooling for slicing the per-route × phase query dumps captured by scripts/query-counts-dump.mjs. Useful when investigating where queries are coming from on a specific route — the catalogue this produced drove the perf reductions in PRs #838, #839, #840.

Layout

  • sqlite/, d1/ — generated dump JSON, one file per route × phase. Gitignored. Regenerate with scripts/query-counts-dump.mjs --target {sqlite|d1}.
  • classification.{sqlite,d1}.md — generated reports from classify.mjs. Gitignored — point-in-time snapshots that go stale on every code change.
  • classify.mjs <target> — produces the classification table from the dumps.
  • cold-only.mjs — diffs cold vs warm in the d1 dumps to surface the cold-isolate startup tax.
  • inspect-other.mjs <target> <class> — prints distinct SQL for a class.

Each dump *.json is an array of { sql, params, durationMs, route, method, phase }. _all.json is the un-grouped feed.

Workflow

node scripts/query-counts.mjs --target sqlite           # build + seed + run main harness
node scripts/query-counts-dump.mjs --target sqlite      # capture per-query dumps
node scripts/query-dumps/classify.mjs sqlite            # write classification.sqlite.md