Skip to content

benchmark rig: the TS/Postgres baseline against LMDB, numbers in docs/rewrite/benchmarks.md #1131

Open

Description

@chappie-daemon

The last remaining slice of #864 (closed): the rig that produces docs/rewrite/benchmarks.md, the
numbers the cutover gate (#869) reads before it can retire the TypeScript implementation.

#864 held four slices. The store landed as job 024-lmdb-store (PR #1073), NIP-50 as job
028-nip50-fts (PR #1113, pr-open), and the migration as job 029-pg-to-lmdb (PR #1125). This
is the fourth: a measurement harness, not a feature.

What it must produce

  • A reproducible rig that measures the LMDB backend and the TypeScript/Postgres implementation
    on the same workload, so the two columns are comparable rather than evocative.
  • docs/rewrite/benchmarks.md with the numbers, the workload that produced them, the machine and
    the date — a document #869 can cite and a later reader can re-run.
  • The workload definition in the repository, not in prose: what events, what mix of reads and
    writes, what concurrency, and what is deliberately excluded.

What it must not do

Detail — the workload, the harness shape, the environment limits and the acceptance criteria —
belongs in the job's spec.md. Filed as #864's remainder rather than reopening it, the same way
#1115 was filed for the migration slice.

Activity

  1. added
    rewritenostream 4.0 Rust/LMDB rewrite
    rustRust implementation work
    factoryBuilt by the software factory
    on Nov 14, 2026
  2. chappie-daemon commented on Nov 14, 2026

    @chappie-daemon
    CollaboratorAuthor

    Opened as job 030-benchmark-rig (factory 0.12.18), cut from rewrite/main at 509b403. Expected cost $2.40 from the measured units in estimates.md; recon starting now.

  3. chappie-daemon commented on Nov 14, 2026

    @chappie-daemon
    CollaboratorAuthor

    Scope decision at spec time, from recon (.factory/jobs/030-benchmark-rig/recon.md#sizing-one-subsystem-or-two): this job builds the rig and measures both Rust backends through one harness — LMDB here, Postgres in CI where checks.yml already declares postgres:16-alpine — because the trait seam makes them the same code and the same workload. The TypeScript relay column is split out to #1132: src/ on this branch is 3.11.0 diverged from origin/main, and there is no Docker, no psql and no node_modules in the member that runs the job. benchmarks.md carries that column as not measured with the reason.

  4. chappie-daemon commented on Nov 15, 2026

    @chappie-daemon
    CollaboratorAuthor

    PR opened: #1141 (3ad5686, base rewrite/main). Merge is Cameri's.

    Cost: $4.15 actual against $2.40 expected (+72.8%) — five review rounds, four builder resumes, one approver escalation and a five-anchor citation correction in the job record. The unit prices in estimates.md held (28 sessions, $0.148 average, inside the builder band); what the estimate got wrong was the round count, because each round's fix introduced the next round's defect — an empty-range measurement, a store-reuse guard validating a path the run did not use, and an exclusion list with three false claims. The regret line in runs.jsonl says so.

    What shipped: the harness (examples/bench.rs), --verify asserting exact expected totals, --repeats N with per-shape bands, docs/rewrite/benchmarks.md + the committed 50k/seed-7 artifact, two CI steps (benchmark unit tests; the Postgres arm), and the ADR 0012 amendment. The TypeScript column is #1132; three wording defects in D9 are #1138–#1140.

  5. chappie-daemon commented on Nov 15, 2026

    @chappie-daemon
    CollaboratorAuthor

    Post-PR rework complete; re-approved at d808694. PR #1141, five automated-review findings fixed (one a P1), two stale document figures corrected.

    Final cost: $4.69 actual against $2.40 expected (+95%), 31 sessions. The operator's own words for the overrun, recorded in regret: the cause is my tolerance, not your build — every extension was authorised after a named finding, and the pre-PR projection (+33%) was met before the automated reviewer found a P1 that five rounds and eighteen lens readings had passed. Unit prices never moved: $0.148 per session.

    What the rework changed:

    • The P1 — the oracle failed correct runs. --verify compared timing.per_second.max(1) against the truth, so a shape whose integer rate rounded to 0 reported failure on a good measurement. It now asserts ops > 0. The oracle has been wrong in both directions: too weak at round 1 (rows > 0 passed a count shape that measured an empty range 49 times of 50), too strict here.
    • --out refused on its parent, so --out /tmp passed and failed after the whole run; now refused at the destination, probing without truncating an existing artifact.
    • Seed arithmetic panicked in a debug build and wrapped in release; now explicitly wrapping, with a u64::MAX boundary test in both profiles.
    • Only the first repeat's read-back was checked; every repeat's now is, naming the index.
    • workload.reads gained by_id_stride/by_id_offset (schema 2), so two by-id workloads cannot look alike.
    • The artifact was regenerated, not edited: new run at load 48.79 (was 43.32) — reads 10–21% slower, create_many 26% faster, counts unchanged. The document quotes the new run; two figures that still came from the old one (48/24416 and a stale date) were caught by the gate lens and corrected.

    Approver's second pass, at the final head: recomputed AC15 independently (181 comparisons, 0 mismatches), re-ran AC4/AC5 and the Oracle (--verify exit 0), git merge-tree clean. Follow-ups: #1143 (the refusal list omits three refusals the harness makes) alongside #1132 and #1138–#1140.

    The process record — cost by stage, findings by instrument, and why a cold automated read beat eighteen briefed lens readings — is .factory/jobs/030-benchmark-rig/process.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    factoryBuilt by the software factoryrewritenostream 4.0 Rust/LMDB rewriterustRust implementation work

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions