diff --git a/README.md b/README.md index 2f205b5a..222541e9 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![sorry](https://img.shields.io/badge/sorry-0-brightgreen)](formal/sorry-budget) [![kernels](https://img.shields.io/badge/kernel_replay-6_checkers-6f42c1)](formal/check.sh) [![attacks](https://img.shields.io/badge/attacks-232_with_controls-blue)](formal/PalaceTest) -[![tests](https://img.shields.io/badge/tests-3721-brightgreen)](docs/runbook.md) +[![tests](https://img.shields.io/badge/tests-3750-brightgreen)](docs/runbook.md) [![coverage](https://img.shields.io/badge/coverage-77%25-green)](pyproject.toml) [![mypy](https://img.shields.io/badge/mypy-0_errors_in_core-brightgreen)](pyproject.toml) [![sealed core](https://img.shields.io/badge/sealed_core-zero_egress-6f42c1)](scripts/check_imports.py) @@ -177,7 +177,7 @@ The build's own history is a dataset. Every commit's structure is snapshotted in ```sh uv sync --extra dev -uv run pytest -q -m 'not live and not podman and not needs_vault and not needs_restic' # the deterministic tier: 3,721 tests +uv run pytest -q -m 'not live and not podman and not needs_vault and not needs_restic' # the deterministic tier: 3,750 tests uv run mypy # strict core: 0 errors (the 67 in tests/ are pinned) uv run python scripts/check_imports.py # the sealed core names no network module uv run python -m ops.type_gate # every core-reaching package is type-checked diff --git a/core/attestation/store.py b/core/attestation/store.py index 64f8fc05..a81eb0a0 100644 --- a/core/attestation/store.py +++ b/core/attestation/store.py @@ -8,6 +8,20 @@ Thread-safety mirrors the JobQueue fix (PROGRESS 2026-06-27): the vault watcher emits ingest attestations from a spawned thread, so the connection is opened `check_same_thread=False` and every method is guarded by a reentrant lock. + +The producer lookups (which attestations name a hash among their outputs) read a side table of +the ledger, one row for each element of each record's `output_hashes` with the record's id and +action, keyed by the hash: a lookup is an index seek, where it was a decode of every record. The +table is written by a trigger on the ledger, so every append writes its rows in its own statement +and transaction, whatever process appends, and a rolled-back append leaves none. A ledger written +before the table existed gets it on its first open, filled from the records in one transaction. +No open or lookup fails because of that migration. It does not wait for the file's write lock: a +process that opens the ledger while another holds the lock opens at once and answers the lookups +by one pass over the records, as the ledger answered them before the table, until a lookup finds +the lock free and makes the table. A migration that fails for any other reason (a file the +process cannot write, a full disk) is rolled back, and the lookups pass over the records until +the ledger is opened again. The table is derived from the records and changes no record: the +ledger stays append-only. """ from __future__ import annotations @@ -36,6 +50,25 @@ CREATE INDEX IF NOT EXISTS att_role_ts ON attestations(agent_role, timestamp); """ +# The output-hash side table: created, filled from the records and given its trigger in one +# transaction (`AttestationStore._migrate`), so its presence means it is complete. `pos` is the +# element's place in the record's `output_hashes`, so a record that names a hash twice has two +# rows, as the records do. +_OUTPUTS = ( + "CREATE TABLE output_hashes (hash TEXT NOT NULL, att_id TEXT NOT NULL, action TEXT NOT NULL, " + "pos INTEGER NOT NULL, PRIMARY KEY (hash, att_id, pos)) WITHOUT ROWID", + "INSERT INTO output_hashes (hash, att_id, action, pos) " + "SELECT j.value, a.id, a.action, j.key FROM attestations a, " + "json_each(a.payload_json, '$.output_hashes') j", + "CREATE TRIGGER attestation_outputs AFTER INSERT ON attestations BEGIN " + "INSERT INTO output_hashes (hash, att_id, action, pos) " + "SELECT j.value, NEW.id, NEW.action, j.key FROM json_each(NEW.payload_json, " + "'$.output_hashes') j; END", +) +_BATCH = 400 +_TIMEOUT_S = 5.0 # how long a statement waits for another connection's lock +_LOCKED = (sqlite3.SQLITE_BUSY, sqlite3.SQLITE_LOCKED) # a lock another connection holds + @dataclass(frozen=True) class AttestationChain: @@ -81,11 +114,54 @@ def __post_init__(self) -> None: self.path.parent.mkdir(parents=True, exist_ok=True) self._lock = threading.RLock() self._defer = False - self._conn = sqlite3.connect(str(self.path), check_same_thread=False) + self._conn = sqlite3.connect(str(self.path), timeout=_TIMEOUT_S, + check_same_thread=False) self._conn.row_factory = sqlite3.Row with self._lock: self._conn.executescript(_DDL) self._conn.commit() + self._migration_failed = False # failed but for the lock: not tried again here + self._indexed = self._migrate() + + def _has_outputs(self) -> bool: + return self._conn.execute("SELECT 1 FROM sqlite_master WHERE type = 'table' " + "AND name = 'output_hashes'").fetchone() is not None + + def _migrate(self) -> bool: + """Give a ledger written before the output-hash side table its table, its rows and its + trigger, in one transaction (another process may have done it first: checked again + inside); True once the table exists. Only the open and the lookups call it, and no SQLite + error of the migration reaches them. The migration does not wait for the write lock: while + another connection holds it nothing is written, the answer is False, and the lookups pass + over the records until a later lookup finds the table or makes it. Any other failure (a + file this process cannot write, a full disk, an I/O error) is rolled back and answers + False, and this store does not try again; its next open does. A crash midway leaves the + ledger as it was, to be migrated at the next open.""" + if self._has_outputs(): + return True + conn = self._conn + if conn.in_transaction: # inside a deferred block: its appends are not ours to end + return False + if self._migration_failed: + return False + try: + conn.execute("PRAGMA busy_timeout = 0") + try: + conn.execute("BEGIN IMMEDIATE") + finally: + conn.execute(f"PRAGMA busy_timeout = {int(_TIMEOUT_S * 1000)}") + if not self._has_outputs(): + for statement in _OUTPUTS: + conn.execute(statement) + conn.commit() + except sqlite3.Error as exc: + conn.rollback() + self._migration_failed = (getattr(exc, "sqlite_errorcode", 0) & 0xFF) not in _LOCKED + return False + except BaseException: + conn.rollback() + raise + return True def append(self, att: Attestation) -> Attestation: """Insert one attestation. Append-only: an id already present is left untouched @@ -135,34 +211,48 @@ def by_role(self, role: str) -> list[Attestation]: return [a for a in self.all() if a.agent_role == role] def producers_by_output(self, hashes: set[str]) -> dict[str, list[tuple[str, str]]]: - """Each hash's producers, (action, id), for many hashes in one pass the database makes - over the ledger (SQLite's JSON functions, no record decoded in Python): what a batch of - landings asks once instead of `producers_of` per landing.""" + """Each hash's producers, (action, id), sorted, an attestation once for each time its + outputs name the hash: what a batch of landings asks once instead of `producers_of` per + landing, a seek of the output-hash table a hash.""" out: dict[str, list[tuple[str, str]]] = {h: [] for h in hashes} - if not hashes: - return out - with self._lock: - self._conn.execute("CREATE TEMP TABLE IF NOT EXISTS wanted_hashes " - "(h TEXT PRIMARY KEY)") - self._conn.execute("DELETE FROM wanted_hashes") - self._conn.executemany("INSERT OR IGNORE INTO wanted_hashes VALUES (?)", - [(h,) for h in hashes]) - rows = self._conn.execute( - "SELECT j.value, a.action, a.id FROM attestations a, " - "json_each(a.payload_json, '$.output_hashes') j " - "WHERE j.value IN (SELECT h FROM wanted_hashes)").fetchall() - self._conn.execute("DELETE FROM wanted_hashes") - for h, action, att_id in rows: + for h, action, att_id in self._outputs(hashes, "hash, action, att_id"): out[str(h)].append((str(action), str(att_id))) return {h: sorted(ps) for h, ps in out.items()} + def _outputs(self, hashes: set[str], columns: str) -> list[sqlite3.Row]: + """The output-hash table's rows for the hashes (`columns` of `hash`, `att_id`, `action`), + by seeks of its key, a statement a few hundred hashes; while the ledger has no table yet + (`_migrate`), the same rows from one pass over the records. Reads alone: no transaction is + opened, so no lock outlives the call.""" + wanted = list(hashes) + rows: list[sqlite3.Row] = [] + with self._lock: + if not self._indexed: + self._indexed = self._migrate() + if not self._indexed: + return self._scanned(wanted, columns) if wanted else [] + for i in range(0, len(wanted), _BATCH): + batch = wanted[i:i + _BATCH] + rows += self._conn.execute( + f"SELECT {columns} FROM output_hashes WHERE hash IN " + f"({', '.join('?' for _ in batch)})", batch).fetchall() + return rows + + def _scanned(self, wanted: list[str], columns: str) -> list[sqlite3.Row]: + """`_outputs`'s rows from the records themselves, for a ledger without the table: one + pass of SQLite's JSON functions over every record, the hashes asked for given as one JSON + array (no temporary table, so no transaction).""" + names = {"hash": "j.value", "att_id": "a.id", "action": "a.action"} + select = ", ".join(f"{names[c.strip()]} AS {c.strip()}" for c in columns.split(",")) + return self._conn.execute( + f"SELECT {select} FROM attestations a, json_each(a.payload_json, '$.output_hashes') j " + "WHERE j.value IN (SELECT value FROM json_each(?))", [json.dumps(wanted)]).fetchall() + def producers_of(self, hashes: set[str]) -> set[str]: """Ids of attestations whose `output_hashes` intersect `hashes` — the attestations that PRODUCED any of those outputs. This is the chain-linking lookup: an action consuming hash h derives from whatever attested producing h (attestation-layer.md §2).""" - if not hashes: - return set() - return {a.id for a in self.all() if hashes & set(a.output_hashes)} + return {str(r[0]) for r in self._outputs(hashes, "att_id")} def chain_for(self, att_id: str) -> AttestationChain: """Assemble the transitive closure following `derived_from_ids`. `complete` is False if diff --git a/core/ingest/landing.py b/core/ingest/landing.py index 50e77c4c..8a3b3111 100644 --- a/core/ingest/landing.py +++ b/core/ingest/landing.py @@ -15,8 +15,9 @@ attest twice. A rename is the one event the digest cannot show: the same bytes under a new path are a version event by the identity design (bp-031), and `sync_path` tells it from a re-run by the catalog, where the old path still binds the identity until the pass tombstones it. The -attestation check scans the store; an index by output hash is the efficiency item if it ever -shows in a profile. +attestation check reads the ledger's output-hash table (`AttestationStore.producers_by_output`), +a seek a digest, where it was a pass over every record: at a few hundred thousand records the pass +took seconds and an item landed effect by effect asked it three times. """ from __future__ import annotations @@ -37,11 +38,15 @@ def record_version_if_new(versions: VersionStore, doc_id: str, digest: str) -> V def attested_by(attestor: Attestor | None, action: str, digest: str) -> list[str]: - """The ids of the attestations of `action` that name `digest` among their outputs, through - the store's producer lookup (`producers_of`, a pass over the ledger).""" + """The ids of the attestations of `action` that name `digest` among their outputs, sorted, + each once: from the store's producers by output (their actions with them) where it has them, + else from its producer ids, each record read for its action.""" store: Any = getattr(attestor, "store", None) if store is None or not digest: return [] + if hasattr(store, "producers_by_output"): + pairs = store.producers_by_output({digest}).get(digest, []) + return sorted({str(att_id) for act, att_id in pairs if act == action}) out = [] for att_id in sorted(store.producers_of({digest})): att = store.get(att_id) @@ -52,11 +57,11 @@ def attested_by(attestor: Attestor | None, action: str, digest: str) -> list[str def attested_batch(attestor: Attestor | None, digests: set[str]) -> dict[str, list[tuple[str, str]]]: - """For many digests in one pass over the ledger, each digest's producers: the attestations, - of any action, whose outputs name it, as (action, id). `attested_by` is the producers of one - action, and an attestation's parents (`StoreAttestor.emit`'s auto-link) the producers of its - inputs; the batched landing reads both off this one pass a batch (`Writer.land_batch`), where - asking per store is two passes a store, which grow with the ledger.""" + """For many digests in one read of the ledger's output-hash table, each digest's producers: + the attestations, of any action, whose outputs name it, as (action, id). `attested_by` is the + producers of one action, and an attestation's parents (`StoreAttestor.emit`'s auto-link) the + producers of its inputs; the batched landing reads both off this one read a batch + (`Writer.land_batch`) rather than asking per store.""" store: Any = getattr(attestor, "store", None) out: dict[str, list[tuple[str, str]]] = {d: [] for d in digests} if store is None or not digests: diff --git a/core/stores/lexical.py b/core/stores/lexical.py index 0594ad6f..196cb02e 100644 --- a/core/stores/lexical.py +++ b/core/stores/lexical.py @@ -16,11 +16,35 @@ lands the second (`derive.derive_lexical`). A query is scored over the current units of the classes a reader may see, by the arithmetic of -`core/ingest/lexical.py`, with the document frequencies, the unit count and the mean length read -from the current units at query time; so a landing changes no stored weight, and the index -needs no rebuild as the corpus grows. The index is derived and regenerable: it can be rebuilt -from the raw store and the catalog, and nothing but a lexical `near` and the UNCHANGED check of a -lazy landing reads it. +`core/ingest/lexical.py`, with the unit count, the mean length and the document frequencies of +those classes' current units. They are kept, not counted at query time: per class, the current +units and their total length (`class_stats`), and per class and term, the current units holding +the term (`term_stats`), written in the transaction of every write that changes which units are +current (a landing, a retire, a reset), from the units whose currency the transaction changed. A +reader's statistics are the sums over its cleared classes' rows and nothing else, so a filtered +read is a function of the cleared rows alone, as when they were counted. A landing changes no +stored weight, and the index needs no rebuild as the corpus grows. The index is derived and +regenerable: it can be rebuilt from the raw store and the catalog, and nothing but a lexical +`near` and the UNCHANGED check of a lazy landing reads it. A store written before the statistics +existed gets them on its first open, counted from its current units in one transaction (a store +whose units another tokenizer made is re-derived first, and its statistics with it); from then on +its units refuse a write that does not come through this class, since a writer that does not +keep the statistics (an older process still running) would leave them wrong without a sign. The +count holds the file's write lock while it runs and does not wait for it: a process that opens +the store while another process counts it, or holds a write, opens at once, and until the +statistics are counted a query counts its own from the units, as every query did before they +were kept (the same integers, so the same scores); a writer waits for the lock as for any write. +A count that fails for any other reason (a file the process cannot write, a full disk) is rolled +back and leaves the store as it was, and its queries count their own until it is opened again: +no open or query fails because of the count. + +The rows a query scores are read from the query terms' postings, or from the given paths' units +when a caller passes paths (the palace's own call, `core/sentence/universe.py`), and the +arithmetic, the sum over the terms and the top `k` are one statement. The sum is written out in +the order of the sorted terms, not taken by SQLite's `sum()`, which compensates its rounding, so +a score is the reference's to the last bit (ties broken by unit id); a query of more terms than +SQLite parses in one sum (`_SUM_TERMS`) has the same weights summed outside the statement, in the +same order. The units' terms are a tokenizer's (`core/ingest/lexical.py::Tokenizer`), and the store records the tokenizer's identity with its first landing, as the plane records its embedder's. A store @@ -28,10 +52,10 @@ a query tokenized one way against units tokenized another would match some words and silently miss others. A store that holds versions and records no identity predates the record, and its units are LEGACY's. Re-deriving is the lexical backfill over a reset index: `reset` forgets the -units, the postings, the versions and the identity, and `derive.derive_lexical`, which resets a -stale index itself, lands every active item again under the current tokenizer. The currency -reads (`holds_current`, `units_of`, the version records) do not depend on the terms and do not -refuse. +units, the postings, the versions, the statistics and the identity, and `derive.derive_lexical`, +which resets a stale index itself, lands every active item again under the current tokenizer. The +currency reads (`holds_current`, `units_of`, the version records) do not depend on the terms and +do not refuse. """ from __future__ import annotations @@ -42,15 +66,24 @@ from dataclasses import dataclass, field from datetime import UTC, datetime from pathlib import Path +from typing import Any import core.ingest.lexical as lexical -from core.ingest.lexical import LEGACY, Tokenizer, TokenizerMismatch, idf, tf_weight +from core.ingest.lexical import LEGACY, Tokenizer, TokenizerMismatch, idf from core.kernel.config import Config from core.kernel.ingest.chunk import Chunk from core.kernel.provenance import Provenance LEXICAL_FILE = "lexical.sqlite" _BATCH = 400 +# The most terms a query's sum is written out for in one statement: SQLite parses `a + b + ...` +# as a tree as deep as its terms and refuses one deeper than 1,000. A longer query's weights are +# summed outside the statement, in the same order. +_SUM_TERMS = 500 +_STATISTICS = "statistics" # the meta key set once the statistics are counted +_WRITER = "writer" # the meta key this class's write transactions hold while they run +_BUSY_MS = 30000 # how long a write waits for another connection's write lock +_LOCKED = (sqlite3.SQLITE_BUSY, sqlite3.SQLITE_LOCKED) # a lock another connection holds _DDL = """ CREATE TABLE IF NOT EXISTS units ( @@ -83,11 +116,38 @@ CREATE TABLE IF NOT EXISTS meta (key TEXT PRIMARY KEY, value TEXT NOT NULL); """ +# The statistics' tables, created by the transaction that first counts them (`_count_statistics`), +# so an open of a store from before them writes nothing unless it counts them. +_STATS_DDL = ( + "CREATE TABLE IF NOT EXISTS class_stats (provenance TEXT PRIMARY KEY, " + "units INTEGER NOT NULL, tokens INTEGER NOT NULL) WITHOUT ROWID", + "CREATE TABLE IF NOT EXISTS term_stats (term TEXT NOT NULL, provenance TEXT NOT NULL, " + "df INTEGER NOT NULL, PRIMARY KEY (term, provenance)) WITHOUT ROWID", +) + +# Installed with the statistics: a write to the units from outside this class's transactions (a +# process that does not keep the statistics) is refused, whole, rather than left to make them +# wrong. A unit's postings are written and deleted only with it, in the same transaction. +_GUARDS = tuple( + f"CREATE TRIGGER IF NOT EXISTS units_kept_{name} BEFORE {event} ON units " + f"WHEN NOT EXISTS (SELECT 1 FROM meta WHERE key = '{_WRITER}') BEGIN " + "SELECT RAISE(ABORT, 'the lexical index keeps statistics of its current units: write its " + "units through core/stores/lexical.py, which keeps them (an older process does not)'); END" + for name, event in (("insert", "INSERT"), + ("update", "UPDATE OF current, provenance, length, unit_id"), + ("delete", "DELETE"))) + def _now() -> str: return datetime.now(UTC).replace(tzinfo=None).isoformat(timespec="seconds") +def _locked(exc: sqlite3.Error) -> bool: + """Whether a statement failed because another connection holds a lock on the file, rather + than for a fault of the file or of the statement.""" + return (getattr(exc, "sqlite_errorcode", 0) & 0xFF) in _LOCKED + + def _batches(items: Sequence[str]) -> Iterator[Sequence[str]]: for i in range(0, len(items), _BATCH): yield items[i:i + _BATCH] @@ -115,6 +175,38 @@ class LexicalHit: score: float +@dataclass(frozen=True) +class LexicalStatistics: + """What a reader's scores are computed with: over the current units of its classes, their + count, their total length in tokens and, for each term asked about, the units holding it.""" + + units: int + tokens: int + df: dict[str, int] + + +class _Currency: + """The units whose currency a transaction changed, each with the sign of its net change (+1 + made current, -1 no longer current); a unit made current and then not, in one transaction, + leaves no change.""" + + def __init__(self) -> None: + self.net: dict[int, int] = {} + + def add(self, unit_ids: Iterable[int], sign: int) -> None: + for uid in unit_ids: + value = self.net.get(uid, 0) + sign + if value: + self.net[uid] = value + else: + self.net.pop(uid, None) + + def take(self, unit_ids: Iterable[int]) -> dict[int, int]: + """The pending changes of these units, removed from the transaction's: they are kept now, + while the units' postings still exist.""" + return {uid: self.net.pop(uid) for uid in unit_ids if uid in self.net} + + def lexical_path(cfg: Config) -> Path: """Where an instance keeps its lexical index: beside its other derived stores.""" return Path(cfg.paths.data_dir) / LEXICAL_FILE @@ -136,14 +228,192 @@ class LexicalStore: def __post_init__(self) -> None: if str(self.path) != ":memory:": self.path.parent.mkdir(parents=True, exist_ok=True) - self._conn = sqlite3.connect(str(self.path), timeout=30.0, isolation_level=None) + self._conn = sqlite3.connect(str(self.path), timeout=_BUSY_MS / 1000, + isolation_level=None) self._conn.execute("PRAGMA journal_mode=WAL") - self._conn.execute("PRAGMA busy_timeout=30000") + self._conn.execute(f"PRAGMA busy_timeout={_BUSY_MS}") self._conn.executescript(_DDL) + self._count_failed = False # a count failed but for the lock: not tried again here + self._migrate() def close(self) -> None: self._conn.close() + # ── transactions ───────────────────────────────────────────────────────────────────────── + + def _begin(self, *, wait: bool = True) -> bool: + """Begin a write transaction of this class: it holds the writer's key, which the units' + guards read, and removes it before it commits, so no other transaction ever sees it. + Called inside the caller's `try`, whose `_rollback` ends the transaction if the key's + write fails. Without `wait`, when another connection holds the write lock nothing begins + and the answer is False.""" + conn = self._conn + if not wait: + conn.execute("PRAGMA busy_timeout=0") + try: + conn.execute("BEGIN IMMEDIATE") + except sqlite3.OperationalError as exc: + if wait or not _locked(exc): + raise + return False + finally: + if not wait: + conn.execute(f"PRAGMA busy_timeout={_BUSY_MS}") + conn.execute("INSERT OR REPLACE INTO meta (key, value) VALUES (?, '1')", [_WRITER]) + return True + + def _commit(self) -> None: + self._conn.execute("DELETE FROM meta WHERE key = ?", [_WRITER]) + self._conn.execute("COMMIT") + + def _rollback(self) -> None: + """End the transaction a failed write left open, if one is: a `BEGIN` that itself failed + left none.""" + if self._conn.in_transaction: + self._conn.execute("ROLLBACK") + + # ── the statistics ─────────────────────────────────────────────────────────────────────── + + def _counted(self) -> bool: + return self._conn.execute("SELECT 1 FROM meta WHERE key = ?", + [_STATISTICS]).fetchone() is not None + + def _migrate(self) -> bool: + """Count the statistics of a store that has none yet (one written before they existed, + or whose record of them was removed), from its current units, in one transaction, and + install the units' guards with them; True once they are counted. Only the open and the + queries call it, and no SQLite error of the count reaches them. The count does not wait + for the file's write lock: while another connection holds it (another process counting, + or writing) nothing is counted, the answer is False, and a later query tries again. Any + other failure of the count (a file this process cannot write, a full disk, an I/O error) + rolls it back, leaves the store as it was and answers False, and this store does not try + again, so a file that cannot take the count is not read through again at every query; + its next open does. Until they are counted, the store's queries count their statistics + from the units (`statistics`). A store whose units another tokenizer made is left alone: + it neither lands nor scores until it is re-derived, and its `reset` counts them.""" + if self._counted(): + return True + if self.stale or self._conn.in_transaction or self._count_failed: + return False + try: + if not self._begin(wait=False): + return False + if not self._counted(): + self._count_statistics() + self._commit() + except sqlite3.Error as exc: + self._rollback() + self._count_failed = not _locked(exc) + return False + except BaseException: + self._rollback() + raise + return True + + def _count_statistics(self) -> None: + """The statistics counted from the units, inside the caller's transaction: one pass over + the postings a class, in term order, so the counts arrive in the table's order.""" + conn = self._conn + for table in _STATS_DDL: + conn.execute(table) + conn.execute("DELETE FROM class_stats") + conn.execute("DELETE FROM term_stats") + conn.execute("INSERT INTO class_stats (provenance, units, tokens) " + "SELECT provenance, count(*), sum(length) FROM units WHERE current = 1 " + "GROUP BY provenance") + for (prov,) in conn.execute( + "SELECT provenance FROM class_stats ORDER BY provenance").fetchall(): + conn.execute("INSERT INTO term_stats (term, provenance, df) " + "SELECT p.term, ?, count(*) FROM postings p " + "CROSS JOIN units u ON u.unit_id = p.unit_id " + "WHERE u.current = 1 AND u.provenance = ? GROUP BY p.term", [prov, prov]) + for guard in _GUARDS: + conn.execute(guard) + conn.execute("INSERT OR REPLACE INTO meta (key, value) VALUES (?, '1')", [_STATISTICS]) + + def _keep(self, changes: dict[int, int]) -> None: + """Move the statistics by the units whose currency changed (+1 made current, -1 no + longer current), inside the caller's transaction and before any of their postings goes; + nothing while the statistics are not counted (their count, when it comes, reads the + units as they are then).""" + if not changes or not self._counted(): + return + conn = self._conn + conn.execute("CREATE TEMP TABLE IF NOT EXISTS lex_shift (unit_id INTEGER PRIMARY KEY)") + conn.execute("CREATE TEMP TABLE IF NOT EXISTS lex_delta (term TEXT NOT NULL, " + "provenance TEXT NOT NULL, n INTEGER NOT NULL, " + "PRIMARY KEY (term, provenance)) WITHOUT ROWID") + for sign in sorted(set(changes.values())): + conn.execute("DELETE FROM temp.lex_shift") + conn.executemany("INSERT INTO temp.lex_shift (unit_id) VALUES (?)", + [(uid,) for uid, s in changes.items() if s == sign]) + conn.execute("INSERT INTO class_stats (provenance, units, tokens) " + "SELECT u.provenance, ? * count(*), ? * sum(u.length) " + "FROM temp.lex_shift s CROSS JOIN units u ON u.unit_id = s.unit_id " + "WHERE true GROUP BY u.provenance " + "ON CONFLICT (provenance) DO UPDATE SET units = units + excluded.units, " + "tokens = tokens + excluded.tokens", [sign, sign]) + conn.execute("DELETE FROM temp.lex_delta") + conn.execute("INSERT INTO temp.lex_delta (term, provenance, n) " + "SELECT p.term, u.provenance, count(*) FROM temp.lex_shift s " + "CROSS JOIN units u ON u.unit_id = s.unit_id " + "CROSS JOIN postings p ON p.unit_id = s.unit_id " + "GROUP BY p.term, u.provenance") + conn.execute("INSERT INTO term_stats (term, provenance, df) " + "SELECT term, provenance, ? * n FROM temp.lex_delta WHERE true " + "ON CONFLICT (term, provenance) DO UPDATE SET df = df + excluded.df", + [sign]) + if sign < 0: + conn.execute("DELETE FROM term_stats WHERE df = 0 AND (term, provenance) IN " + "(SELECT term, provenance FROM temp.lex_delta)") + conn.execute("DELETE FROM class_stats WHERE units = 0") + + def statistics(self, *, classes: Iterable[Provenance] | None = None, + terms: Iterable[str] = ()) -> LexicalStatistics: + """A reader's statistics: the sums of its classes' rows (every class when None), over + the current units; a term no current unit of those classes holds has no entry. Until the + statistics are counted (`_migrate`) they are counted here, from the units of those + classes, as a query counted them before they were kept.""" + cls = list(classes) if classes is not None else None + values = sorted({p.value for p in cls}) if cls is not None else None + if values is not None and not values: + return LexicalStatistics(0, 0, {}) + wanted = sorted(set(terms)) + if not self._counted(): + return self._count_now(cls, wanted) + where = f" WHERE provenance IN ({', '.join('?' for _ in values)})" if values else "" + n, total = self._conn.execute( + f"SELECT COALESCE(sum(units), 0), COALESCE(sum(tokens), 0) FROM class_stats{where}", + values or []).fetchone() + df: dict[str, int] = {} + for batch in _batches(wanted): + marks = ", ".join("?" for _ in batch) + clause = f" AND provenance IN ({', '.join('?' for _ in values)})" if values else "" + for term, count in self._conn.execute( + f"SELECT term, sum(df) FROM term_stats WHERE term IN ({marks}){clause} " + "GROUP BY term", [*batch, *(values or [])]): + if int(count): + df[str(term)] = int(count) + return LexicalStatistics(int(n), int(total), df) + + def _count_now(self, classes: list[Provenance] | None, + terms: list[str]) -> LexicalStatistics: + """`statistics` counted from the units, for a store whose statistics are not counted yet: + the current units of the classes (every class when None) and their lengths, and each + term's current units, its postings read first.""" + where, params = self._class_clause(classes, "u.provenance") + n, total = self._conn.execute( + "SELECT count(*), COALESCE(sum(u.length), 0) FROM units u " + f"WHERE u.current = 1{where}", params).fetchone() + df: dict[str, int] = {} + for term in terms: + (count,) = self._conn.execute( + "SELECT count(*) FROM postings p CROSS JOIN units u ON u.unit_id = p.unit_id " + f"WHERE p.term = ? AND u.current = 1{where}", [term, *params]).fetchone() + if int(count): + df[term] = int(count) + return LexicalStatistics(int(n), int(total), df) + # ── the tokenizer's identity ───────────────────────────────────────────────────────────── def recorded_tokenizer(self) -> str | None: @@ -178,19 +448,20 @@ def _check_tokenizer(self, *, record: bool) -> None: "item again)") def reset(self) -> None: - """Forget every unit, posting and version record, and the recorded tokenizer, in one - transaction: the index is derived, and the lexical backfill rebuilds it from the raw - store (`derive.derive_lexical`).""" + """Forget every unit, posting, version record and statistic, and the recorded tokenizer, + in one transaction: the index is derived, and the lexical backfill rebuilds it from the + raw store (`derive.derive_lexical`). The empty store's statistics are counted (none).""" conn = self._conn - conn.execute("BEGIN IMMEDIATE") try: + self._begin() conn.execute("DELETE FROM postings") conn.execute("DELETE FROM units") conn.execute("DELETE FROM versions") conn.execute("DELETE FROM meta WHERE key = 'tokenizer'") - conn.execute("COMMIT") + self._count_statistics() + self._commit() except BaseException: - conn.execute("ROLLBACK") + self._rollback() raise # ── landing and retiring ───────────────────────────────────────────────────────────────── @@ -207,20 +478,22 @@ def land_many(self, items: Sequence[tuple[str, str, str, str, Sequence[Chunk]]] ) -> list[LexicalLanding]: """Land several versions, each `(source_path, digest, provenance, title, chunks)`, in one transaction, each as `land` lands it: a batched landing's lexical stage, or a backfill's. + The statistics move with the currency in the same transaction, once for the whole batch. The transaction commits every version or none.""" - conn = self._conn - conn.execute("BEGIN IMMEDIATE") try: + self._begin() self._check_tokenizer(record=True) - out = [self._land_one(*item) for item in items] - conn.execute("COMMIT") + currency = _Currency() + out = [self._land_one(*item, currency=currency) for item in items] + self._keep(currency.net) + self._commit() except BaseException: - conn.execute("ROLLBACK") + self._rollback() raise return out def _land_one(self, source_path: str, digest: str, provenance: str, title: str, - chunks: Sequence[Chunk]) -> LexicalLanding: + chunks: Sequence[Chunk], *, currency: _Currency) -> LexicalLanding: conn = self._conn wanted = {c.index for c in chunks} held = {int(r[0]) for r in conn.execute( @@ -228,9 +501,15 @@ def _land_one(self, source_path: str, digest: str, provenance: str, title: str, [source_path, digest])} written = 0 if held != wanted: - for (uid,) in conn.execute( - "SELECT unit_id FROM units WHERE source_path = ? AND digest = ?", - [source_path, digest]).fetchall(): + gone = [int(r[0]) for r in conn.execute( + "SELECT unit_id FROM units WHERE source_path = ? AND digest = ?", + [source_path, digest]).fetchall()] + # units leaving while current leave the statistics first, while their postings exist + currency.add([int(r[0]) for r in conn.execute( + "UPDATE units SET current = 0 WHERE source_path = ? AND digest = ? " + "AND current = 1 RETURNING unit_id", [source_path, digest]).fetchall()], -1) + self._keep(currency.take(gone)) + for uid in gone: conn.execute("DELETE FROM postings WHERE unit_id = ?", [uid]) conn.execute("DELETE FROM units WHERE source_path = ? AND digest = ?", [source_path, digest]) @@ -248,21 +527,33 @@ def _land_one(self, source_path: str, digest: str, provenance: str, title: str, written += 1 conn.execute("INSERT OR REPLACE INTO versions (source_path, digest, units) " "VALUES (?, ?, ?)", [source_path, digest, len(wanted)]) - superseded = conn.execute( + superseded = [int(r[0]) for r in conn.execute( "UPDATE units SET current = 0 WHERE source_path = ? AND digest <> ? " - "AND current = 1", [source_path, digest]).rowcount - made = conn.execute( + "AND current = 1 RETURNING unit_id", [source_path, digest]).fetchall()] + made = [int(r[0]) for r in conn.execute( "UPDATE units SET current = 1 WHERE source_path = ? AND digest = ? " - "AND current = 0", [source_path, digest]).rowcount - return LexicalLanding(units_written=written, superseded=int(superseded), - made_current=made > 0) + "AND current = 0 RETURNING unit_id", [source_path, digest]).fetchall()] + currency.add(superseded, -1) + currency.add(made, +1) + return LexicalLanding(units_written=written, superseded=len(superseded), + made_current=bool(made)) def retire(self, source_path: str) -> int: """The path is gone: its units stop being current and stay, as the plane keeps a retired - version's rows. Returns the units retired.""" - return int(self._conn.execute( - "UPDATE units SET current = 0 WHERE source_path = ? AND current = 1", - [source_path]).rowcount) + version's rows, and leave the statistics in the same transaction. Returns the units + retired.""" + conn = self._conn + try: + self._begin() + gone = [int(r[0]) for r in conn.execute( + "UPDATE units SET current = 0 WHERE source_path = ? AND current = 1 " + "RETURNING unit_id", [source_path]).fetchall()] + self._keep({uid: -1 for uid in gone}) + self._commit() + except BaseException: + self._rollback() + raise + return len(gone) # ── what is held ───────────────────────────────────────────────────────────────────────── @@ -305,89 +596,127 @@ def count(self, *, classes: Iterable[Provenance] | None = None) -> int: # ── scoring ────────────────────────────────────────────────────────────────────────────── @staticmethod - def _class_clause(classes: Iterable[Provenance] | None) -> tuple[str, list[str]]: + def _class_clause(classes: Iterable[Provenance] | None, + column: str = "provenance") -> tuple[str, list[str]]: if classes is None: return "", [] values = sorted({p.value for p in classes}) if not values: return " AND 0", [] - return f" AND provenance IN ({', '.join('?' for _ in values)})", values - - def _stats(self, classes: Iterable[Provenance] | None) -> tuple[int, float]: - where, params = self._class_clause(classes) - n, total = self._conn.execute( - f"SELECT count(*), COALESCE(sum(length), 0) FROM units WHERE current = 1{where}", - params).fetchone() - return int(n), (float(total) / int(n) if n else 0.0) - - def _score_units(self, query: str, *, classes: Iterable[Provenance] | None, - paths: Collection[str] | None) -> dict[int, float]: - """Every current unit's BM25 score for a query, among the classes (all when None) and the - paths (all when None); units sharing no term with the query are absent.""" + return f" AND {column} IN ({', '.join('?' for _ in values)})", values + + def _ranked(self, query: str, *, classes: Iterable[Provenance] | None, + paths: Collection[str] | None, k: int | None, per_path: bool) -> list[Any]: + """The current units' BM25 scores for a query, among the classes (all when None) and the + paths (all when None), in one statement: `(unit_id, score, source_path, digest, + chunk_index, title, provenance)` best first, ties by unit id, the first `k` (every one + when None); or with `per_path`, `(source_path, score)`, each path's best unit. A unit + that shares no term with the query is absent. + + Each posting's weight is `core/ingest/lexical.py`'s arithmetic, operation for operation, + and a unit's score is the sum of its terms' weights in the order of the sorted terms, + written out, each term the unit lacks adding 0.0; adding 0.0 leaves a positive double as + it is, so the sum is the reference loop's to the bit. Past `_SUM_TERMS` terms the weights + come out of the statement in that order and are summed here.""" self._check_tokenizer(record=False) + if not self._counted(): + self._migrate() # without waiting: else `statistics` counts them below terms = sorted(set(self.tokenizer(query))) cls = list(classes) if classes is not None else None - n, avgdl = self._stats(cls) - if n == 0 or not terms: - return {} - where, params = self._class_clause(cls) - scores: dict[int, float] = {} - path_batches: list[Sequence[str]] = (list(_batches(sorted(set(paths)))) - if paths is not None else [()]) - for term in terms: - df = int(self._conn.execute( - "SELECT count(*) FROM postings p JOIN units u ON u.unit_id = p.unit_id " - f"WHERE p.term = ? AND u.current = 1{where}", [term, *params]).fetchone()[0]) - if df == 0: - continue - weight = idf(n, df) - for batch in path_batches: - extra, more = "", [] - if paths is not None: - if not batch: - continue - extra = f" AND u.source_path IN ({', '.join('?' for _ in batch)})" - more = list(batch) - for uid, tf, dl in self._conn.execute( - "SELECT p.unit_id, p.tf, u.length FROM postings p " - "JOIN units u ON u.unit_id = p.unit_id " - f"WHERE p.term = ? AND u.current = 1{where}{extra}", - [term, *params, *more]): - scores[int(uid)] = scores.get(int(uid), 0.0) \ - + weight * tf_weight(int(tf), int(dl), avgdl) - return scores + stats = self.statistics(classes=cls, terms=terms) + if stats.units == 0 or not terms: + return [] + avgdl = float(stats.tokens) / stats.units + weighted = [(t, idf(stats.units, stats.df[t])) for t in terms if stats.df.get(t, 0)] + wanted = sorted(set(paths)) if paths is not None else None + if not weighted or wanted == []: + return [] + conn = self._conn + conn.execute("CREATE TEMP TABLE IF NOT EXISTS lex_query (i INTEGER PRIMARY KEY, " + "term TEXT NOT NULL, w REAL NOT NULL)") + conn.execute("DELETE FROM temp.lex_query") + conn.executemany("INSERT INTO temp.lex_query (i, term, w) VALUES (?, ?, ?)", + [(i, t, w) for i, (t, w) in enumerate(weighted)]) + where, values = self._class_clause(cls, "u.provenance") + if wanted is not None: + conn.execute("CREATE TEMP TABLE IF NOT EXISTS lex_paths (path TEXT PRIMARY KEY)") + conn.execute("DELETE FROM temp.lex_paths") + conn.executemany("INSERT INTO temp.lex_paths (path) VALUES (?)", + [(p,) for p in wanted]) + # the paths' units by their index: with no planner statistics, SQLite would take the + # class's index and visit every current unit of the class for each path + rows = ("FROM temp.lex_paths w CROSS JOIN units u INDEXED BY units_path " + "ON u.source_path = w.path AND u.current = 1 CROSS JOIN temp.lex_query q " + "CROSS JOIN postings p ON p.term = q.term AND p.unit_id = u.unit_id " + f"WHERE true{where}") + else: + rows = ("FROM temp.lex_query q CROSS JOIN postings p ON p.term = q.term " + f"CROSS JOIN units u ON u.unit_id = p.unit_id WHERE u.current = 1{where}") + k1, b = lexical.K1, lexical.B + weights = ("SELECT p.unit_id AS unit_id, q.i AS i, " + "q.w * ((p.tf * ?) / (p.tf + ? * (? + (? * u.length) / ?))) AS c " + rows) + params: list[Any] = [k1 + 1.0, k1, 1.0 - b, b, avgdl, *values] + if len(weighted) > _SUM_TERMS: + # past SQLite's depth for one written-out sum: the same weights, summed here in the + # same order of the terms + acc: dict[int, float] = {} + for uid, _, c in conn.execute(weights + " ORDER BY q.i", params): + acc[int(uid)] = acc.get(int(uid), 0.0) + float(c) + return self._rank_sums(acc, k=k, per_path=per_path) + total = " + ".join(f"COALESCE(max(r.c) FILTER (WHERE r.i = {i}), 0.0)" + for i in range(len(weighted))) + scored = f"SELECT r.unit_id AS unit_id, {total} AS score FROM ({weights}) r " \ + "GROUP BY r.unit_id" + if per_path: + sql = (f"SELECT u.source_path, max(s.score) FROM ({scored}) s " + "CROSS JOIN units u ON u.unit_id = s.unit_id " + "GROUP BY u.source_path ORDER BY min(s.unit_id)") + else: + sql = (f"SELECT s.unit_id, s.score, u.source_path, u.digest, u.chunk_index, u.title, " + f"u.provenance FROM ({scored} ORDER BY score DESC, unit_id LIMIT ?) s " + "CROSS JOIN units u ON u.unit_id = s.unit_id " + "ORDER BY s.score DESC, s.unit_id") + params.append(-1 if k is None else k) + return conn.execute(sql, params).fetchall() + + def _rank_sums(self, acc: dict[int, float], *, k: int | None, + per_path: bool) -> list[Any]: + """`_ranked`'s rows from scores summed outside the statement: the top `k` with their + units' fields, best first, ties by unit id; or each path's best, in the order of its + first unit.""" + conn = self._conn + if per_path: + best: dict[str, float] = {} + ids = sorted(acc) + for i in range(0, len(ids), _BATCH): + batch = ids[i:i + _BATCH] + for uid, path in conn.execute( + "SELECT unit_id, source_path FROM units WHERE unit_id IN " + f"({', '.join('?' for _ in batch)}) ORDER BY unit_id", batch): + p = str(path) + best[p] = max(best[p], acc[int(uid)]) if p in best else acc[int(uid)] + return list(best.items()) + ranked = sorted(acc.items(), key=lambda kv: (-kv[1], kv[0])) + out = [] + for uid, score in ranked if k is None else ranked[:k]: + row = conn.execute("SELECT source_path, digest, chunk_index, title, provenance " + "FROM units WHERE unit_id = ?", [uid]).fetchone() + out.append((uid, score, *row)) + return out def search(self, query: str, *, k: int = 10, classes: Iterable[Provenance] | None = None, paths: Collection[str] | None = None) -> list[LexicalHit]: """The `k` best current units for a query, best first, ties by unit id; a unit that shares no term with the query is never returned.""" - scored = self._score_units(query, classes=classes, paths=paths) - if not scored: - return [] - best = sorted(scored.items(), key=lambda kv: (-kv[1], kv[0]))[:k] - out = [] - for uid, score in best: - row = self._conn.execute( - "SELECT source_path, digest, chunk_index, title, provenance FROM units " - "WHERE unit_id = ?", [uid]).fetchone() - out.append(LexicalHit(str(row[0]), str(row[1]), int(row[2]), str(row[3]), - str(row[4]), float(score))) - return out + rows = self._ranked(query, classes=classes, paths=paths, k=k if k >= 0 else None, + per_path=False) + hits = [LexicalHit(str(r[2]), str(r[3]), int(r[4]), str(r[5]), str(r[6]), float(r[1])) + for r in rows] + return hits if k >= 0 else hits[:k] def scores(self, query: str, *, classes: Iterable[Provenance] | None = None, paths: Collection[str] | None = None) -> dict[str, float]: """Each path's score for a query: the best of its current units' scores; paths sharing no term with the query are absent.""" - scored = self._score_units(query, classes=classes, paths=paths) - if not scored: - return {} - out: dict[str, float] = {} - ids = sorted(scored) - for i in range(0, len(ids), _BATCH): - batch = ids[i:i + _BATCH] - for uid, path in self._conn.execute( - "SELECT unit_id, source_path FROM units WHERE unit_id IN " - f"({', '.join('?' for _ in batch)})", batch): - p = str(path) - out[p] = max(out.get(p, 0.0), scored[int(uid)]) - return out + return {str(p): float(s) for p, s in + self._ranked(query, classes=classes, paths=paths, k=None, per_path=True)} diff --git a/docs/design-notes/dn-temporal-snapshot.md b/docs/design-notes/dn-temporal-snapshot.md index dc1dac9d..1b338534 100644 --- a/docs/design-notes/dn-temporal-snapshot.md +++ b/docs/design-notes/dn-temporal-snapshot.md @@ -235,7 +235,7 @@ the state files are left out, each with its reason (§1.3). |---|---|---|---| | raw objects (`core/kernel/stores/rawstore.py:28-40`) | none of its own; an object is ordered by the events that name its digest | the digest | nothing is rewritten; a purge deletes the object (`rawstore.py:51-61`); a transcript that grew is retained whole again under a new digest (`ops/chat_sensor.py:289-333`) | | version chains (`core/stores/versions.py:77-86`) | `version_seq` per document | `(doc_id, version_seq)` | nothing (one admitted relabel of `doc_id`, `versions.py:132`); kept by one place only, `mirror_authored` (`core/ingest/table.py:241-251`) | -| attestations (`core/attestation/store.py:27-36`) | insertion order and the parents' graph; read back `ORDER BY timestamp, id` (`store.py:130`) | the content-addressed id | nothing; one per (action, digest), and one more for a landing that appended a version (`core/ingest/landing.py:77-86`), so not one a landing outside the place that keeps chains, and no path | +| attestations (`core/attestation/store.py`, `_DDL`) | insertion order and the parents' graph; read back `ORDER BY timestamp, id` (`AttestationStore.all`) | the content-addressed id | nothing; one per (action, digest), and one more for a landing that appended a version (`core/ingest/landing.py`, `attest_once`), so not one a landing outside the place that keeps chains, and no path | | chat utterances (`core/stores/chatlog.py:77-92`) | `turn_index` per session | `(session_id, turn_index)` | nothing: the first write of a turn stands (`chatlog.py:161`); the store is wiped by a reset and filled again from the raw store (`chatlog.py:41-45`) | | citation readings (`core/stores/reference_edges.py:134-148`) | the commit of the reading; git orders the commits | `commit_sha`, part of every edge's identity (`reference_edges.py:164-174`) | no row: the store is append-only (`reference_edges.py:289-302`). What is lost is which projection wrote an edge: a deliberate re-projection under a later extractor (`ops/code_sensor.py:827-845`, through `_project`, `:473-490`) adds edges under the old `commit_sha`, the rows carry no extractor version, and one is owed (`code_sensor.py:83-91`). So a commit's reading is the union of every projection of it so far, not a function of its tree | | commit ledger (`ops/code_snapshot.py:44-58`) | git's ancestry: the ledger keeps no parent, and the sensor reads the commits of one branch in `rev-list` order (`ops/code_sensor.py:404-418`) | `commit_sha` | nothing | @@ -256,7 +256,7 @@ the state files are left out, each with its reason (§1.3). | the plane's supersession log (`plane.py:282-289`) | `seq` per path | (path, seq) | a purge deletes entries and the next entry takes the position again (`plane.py:491-495`, `:552-553`) `[MEASURED §11]`; a reset drops it (`plane.py:628-640`); an instance with no plane has none; under lazy embedding it is written by the drain, in the drain's order, and only for the versions still current then (`core/ingest/derive.py:85-118`) | | atoms (the vector table) | none: content-addressed (`plane.py:113-115`) | the atom's id | the `held` and `current` cache columns; the table's own dataset versions, one a write, which a compaction drops (`core/stores/vectorstore.py:780-812`) | | the curated store: a second vector table with a plane of its own (`core/stores/curated_store.py:30-38`, `core/stores/vectorstore.py:243`) | as the plane and the atoms | as the plane and the atoms | as the plane and the atoms. It has two writers. `ingest_curated` lands through the catalog (`core/ingest/curated.py:66-82`). `scripts/curate_local.py:96-108` writes rows with `store.add` and no catalog row, raw object or attestation, so nothing positions them. `near` seeds from it (`core/sentence/universe.py:378-393`) and `read` opens its rows (`core/sentence/execute.py:318-326`); the purge does not open it (`scripts/purge_raw.py:51-56`) | -| lexical units and postings (`core/stores/lexical.py:56-82`) | none: `landed_at` is wall time | (path, digest, chunk) | the head flag (`lexical.py:251-256`, `:260-265`); every unit, when the tokenizer changes (`lexical.py:180-194`) | +| lexical units and postings (`core/stores/lexical.py`, `units` and `postings`) | none: `landed_at` is wall time | (path, digest, chunk) | the head flag (`LexicalStore._land_one`, `LexicalStore.retire`); every unit, when the tokenizer changes (`LexicalStore.reset`) | | code memberships (`core/stores/memberships.py:140-155`) | git: (path, blob) | the version's identity | the head flag; a purge leaves a recorded hole (`memberships.py:153`, `:491-497`) | **Stores rewritten in place: no past.** @@ -293,8 +293,8 @@ in §2.2 unless given]` dialogue, observed and curated places a landing attests once per (action, digest), so a path that returns to bytes it held before, or bytes that land at a second path, leave no new record. In `mirror_authored` both append a version and are attested again - (`core/ingest/landing.py:77-86`, `core/ingest/writer.py:409-418`), which is the one place - whose past is already kept. The ledger is read back in wall-time order. + (`core/ingest/landing.py`, `attest_once`; `core/ingest/writer.py:409-418`), which is the one + place whose past is already kept. The ledger is read back in wall-time order. 3. **Lexical postings and a changed item's vectors are not rewritten.** The units and the occupancies of a superseded version stay; only a `current` flag moves. They are generations in all but the stamp. And a stamp on the row would be wrong: a path that returns to bytes it held @@ -901,7 +901,7 @@ measured: | a document's version chain | the log's `store` rows of the identity at or under `c` (§6.2) | the same rows in the range | `landings_path` where the identity is the path, `landings_doc` where it is not | 9 µs for seven versions through the index, and 49 to 57 ms when the planner takes the primary key, so the statement names the index `[MEASURED §11]` | | raw objects | the object of the digest the log names at `c` | the objects the delta names | none: content-addressed | one file read, the object's bytes | | chat log | a session's turns whose chain number is at or under `c` | the turns numbered in the range | the chain table's key and its `(session, turn)` | a range of an integer key: of the order of the log's 0.7 ms a thousand rows | -| attestations | by id, as today; in order, the chain table at or under `c` | a range of the chain table | the chain table | the same order, where `all()` sorts the ledger by wall time and `producers_of` decodes every record today (`core/attestation/store.py:127-132`, `:159-165`) | +| attestations | by id, as today; in order, the chain table at or under `c` | a range of the chain table | the chain table | the same order, where `all()` sorts the ledger by wall time; `producers_of` reads the output-hash table, one row an output of a record, written by the ledger's trigger (2026-11-11) | | citation readings | the edges of the commit projected at or under `c` on `att` (§5.1) | the paths whose blob differs between the two commits, by the commit ledger's `files` rows (`ops/code_snapshot.py:59-69`), with their readings at each | exists: `(target_ref, commit_sha)` and `(source_ref, commit_sha)` (`reference_edges.py:149-156`); the projection's position is one integer column more | one indexed lookup a reference, as today | | commit ledger | the commit and, through git, its ancestors | git's range | none: the ledger keeps no parent, so the range is git's | one `rev-list`, not measured | | staging | `read_at(g)`, as built | the rows admitted or tombstoned in the range | `staged_rows_generation` exists; none on the tombstone stamp | a range of the generation index; a scan for the tombstones | @@ -1021,11 +1021,14 @@ Three things follow. ### 5.3 The lexical index -The index keeps every version's units and postings and marks the head -(`core/stores/lexical.py:56-82`, `:251-256`), and it computes its statistics at query time over -the current units of the reader's classes: the unit count and the mean length -(`lexical.py:316-321`) and each term's document frequency (`lexical.py:337-340`). -`[ESTABLISHED]` At a cut the arithmetic is the same with one predicate changed: a unit counts +The index keeps every version's units and postings and marks the head (`core/stores/lexical.py`, +`units` and `_land_one`), and it scores with the statistics of the current units of the reader's +classes: the unit count and the mean length and each term's document frequency, counted at query +time until 2026-11-11 and kept since, per class, in the transaction of every write that moves the +currency (`class_stats`, `term_stats`), a reader's the sums over its classes' rows. The kept +statistics are the present's; a read at a cut counts its own under the cut's mask, as the store +counted them before, or keeps them per epoch. `[ESTABLISHED]` At a cut the arithmetic is the same +with one predicate changed: a unit counts when its version is its path's head at the cut, in place of `current = 1`. The collection size, the mean length and the document frequencies are then the masked set's own, which is what makes a score at a cut the score the index gave then under the same tokenizer. A clearance and a cut @@ -1037,10 +1040,11 @@ the statistics are the collection's and not the support's: every unit of every h mask reads the units' stored lengths and postings. A journal of the changes to the document frequencies has an entry a term a unit, no fewer than the postings (122 a unit on the synthetic text). An index with its statistics built in cannot serve a cut, or a clearance, without a copy a mask; if the index moves to immutable -segments, a segment carries no statistics and they are computed from the mask, as they are -today, until a query at a past cut runs over its budget (SN-e). None of the three is measured +segments, a segment carries no statistics and they are computed from the mask, as the store +computed them for every query before it kept them, until a query at a past cut runs over its +budget (SN-e). None of the three is measured at a corpus's size. `[INFERENCE, falsifier SNF-7]` The tokenizer's identity is the -present's, as the embedder's is: a changed tokenizer resets the index (`lexical.py:180-194`) and +present's, as the embedder's is: a changed tokenizer resets the index (`LexicalStore.reset`) and the backfill lands the active items, so a superseded version's units are derived again from the raw store when a cut asks for them. @@ -1418,10 +1422,10 @@ within them, to the events it may see named (`snapshot`). The grant is no functi an answer when the answer is a filter of the read, as the members of `reach`, `trace`, `read` and `changed` are. They do not pass to a score. A lexical score uses the statistics of the reader's own classes, the unit count, the mean length and each term's document frequency -(`core/stores/lexical.py:316-321`, `:337-340`), and §5.3 keeps it so; a rank depends on every -candidate. So for a sentence that scores or ranks, the narrower answer is not the wider one -masked, at the head today as at a cut, and nothing here claims it is. `[ESTABLISHED for the -statistics]` +(`LexicalStore.statistics`, sums of the reader's classes' rows), and §5.3 keeps it so; a rank +depends on every candidate. So for a sentence that scores or ranks, the narrower answer is not +the wider one masked, at the head today as at a cut, and nothing here claims it is. +`[ESTABLISHED for the statistics]` **The cut shown.** `snapshot_congr` holds for a fixed cut. The cut read is resolved over every chain (§7.1), and its position on a chain the grant names can depend on a chain the grant does @@ -1692,7 +1696,7 @@ So the horizon is recorded, and a cut under it is not served. ### 9.1 What grows A landing drops nothing today: a retired path's rows and a superseded version's rows stay in the -plane and in the lexical index (`core/stores/plane.py:497-499`, `core/stores/lexical.py:260-265`), +plane and in the lexical index (`core/stores/plane.py:497-499`, `LexicalStore.retire`), and rows go only with a purge or a reset. So the bytes of a past are mostly paid already, and the snapshot adds three things. @@ -2380,7 +2384,8 @@ give, and what each alternative costs is the answers it changes, which the entry row, after which no attestation can be tested against a guess of the content. It costs a side row a distinct digest, of the order of a hundred bytes; a lookup an attestation; every reader that matches an attestation's hashes against a digest going through the side table - (`core/attestation/attestor.py:59-69`, `core/ingest/landing.py:60-75`); and an outside + (`core/attestation/attestor.py:59-69`, `core/ingest/landing.py`, `attested_by` and + `attested_batch`); and an outside verifier needing the salt to check an attestation against bytes. The rows written before stay, and a purge lists their ids as what it could not reach. The alternatives. Name the landing log's commitment in the attestation: the log's row, its salt and its position are diff --git a/docs/design-notes/dn-two-phase-ingestion.md b/docs/design-notes/dn-two-phase-ingestion.md index cc7a5d89..cb8e2675 100644 --- a/docs/design-notes/dn-two-phase-ingestion.md +++ b/docs/design-notes/dn-two-phase-ingestion.md @@ -422,7 +422,12 @@ request and its own plane transaction; the drain lands 64 at a time. `[MEASURED: first gigabyte; at a hundred gigabytes the posting lists are the plane's size. The corpus's battery already holds the weights as a sparse matrix built in bulk (`LexicalIndex`); serving queries from it, or from an on-disk inverted index with skip lists, is the next form. The - reconciliation (a version's units written once, the currency last) carries over. + reconciliation (a version's units written once, the currency last) carries over. The first + step is taken (2026-11-11, `docs/experiments/keyword-and-ledger-2026-11-11.md`): the unit count, + the total length and the document frequencies are kept per class in the transaction of every + write that changes which units are current, a reader's statistics are its cleared classes' + rows summed, and the arithmetic, the sum and the top `k` are one statement read from the + query terms' postings or the given paths' units, the scores the old statements' to the bit. 2. **Yielding.** The daemon's drain takes the embedder's time in batches of 64 without asking who else is waiting. The corpus runner's backfill drains through its gated embedder, which waits while another principal has a request in flight; the right place for that policy is the diff --git a/docs/experiments/keyword-and-ledger-2026-11-11.json b/docs/experiments/keyword-and-ledger-2026-11-11.json new file mode 100644 index 00000000..afd3dbbf --- /dev/null +++ b/docs/experiments/keyword-and-ledger-2026-11-11.json @@ -0,0 +1,10026 @@ +{ + "experiment": "keyword-and-ledger", + "date": "2026-11-11", + "harness": "eval/stress_battery.py", + "command": "uv run python -m eval.stress_battery --source --scratch --out --queries <16 titles> --tokenizer legacy --passes 5 --fresh 3 --fresh-qids L0,L11,L23 --path-qids L0,L6,L11,L17,L23 --runs 3", + "corpus": { + "items": 400274, + "units": 1369944, + "units_current": 1369944, + "classes": [ + "observed" + ], + "postings": 117975818, + "attestations": 387838, + "tokenizer": "LEGACY (the file predates the recorded identity)" + }, + "queries": { + "titles": "16: ten from the query set of an earlier, unpublished study of the stores (L0..L25, their places in it) and six drawn independently (S0..S5); texts not recorded", + "paths": "400 random item paths (seed 20261111)", + "path_queries": [ + "L0", + "L6", + "L11", + "L17", + "L23" + ], + "fresh_queries": [ + "L0", + "L11", + "L23" + ] + }, + "conditions": { + "machine": "arm64", + "cpus": 12, + "python": "3.15.2", + "sqlite": "3.54.1", + "blas_threads": 4, + "rss_cap_gb": 3.8, + "load": "the one-minute load average, read beside every timing" + }, + "before": { + "code": { + "git": "", + "label": "main-f969904e" + }, + "started": "2026-11-12T05:12:05+00:00", + "finished": "2026-11-12T06:08:58+00:00", + "load_start_1min": 4.21, + "load_end_1min": 2.21, + "peak_rss_mb": 822.1 + }, + "after": { + "code": { + "git": "b61c0ca040e660a96c7f0be96ce1966b2ed5cb94", + "label": "branch-b61c0ca0" + }, + "started": "2026-11-12T08:25:27+00:00", + "finished": "2026-11-12T08:39:27+00:00", + "load_start_1min": 1.96, + "load_end_1min": 3.38, + "peak_rss_mb": 541.5 + }, + "answers": { + "compared": 65, + "identical": 65, + "differ": [], + "earlier_before_run_compared": 65, + "earlier_before_run_identical": 65, + "every_run": { + "run 1": { + "compared_with_run_4": 65, + "identical": 65 + }, + "run 2": { + "compared_with_run_4": 65, + "identical": 65 + }, + "run 3": { + "compared_with_run_4": 65, + "identical": 65 + }, + "run 5": { + "compared_with_run_4": 65, + "identical": 65 + } + } + }, + "prepare": { + "before": { + "lexical.sqlite": { + "open_s": 0.001, + "load_1min": 4.21, + "load_end_1min": 4.21, + "bytes_before": 4613689344, + "bytes_after": 4613697536, + "migrated": false + }, + "attestations.sqlite": { + "open_s": 0.0, + "load_1min": 4.21, + "load_end_1min": 4.21, + "bytes_before": 313348096, + "bytes_after": 313348096, + "migrated": false + } + }, + "after": { + "lexical.sqlite": { + "open_s": 125.98, + "load_1min": 1.96, + "load_end_1min": 3.04, + "bytes_before": 4613689344, + "bytes_after": 4643323904, + "migrated": true + }, + "attestations.sqlite": { + "open_s": 2.684, + "load_1min": 3.04, + "load_end_1min": 3.04, + "bytes_before": 313348096, + "bytes_after": 377790464, + "migrated": true + } + } + }, + "keyword": { + "before": { + "open_s": 0.00061, + "open_load_1min": 4.21, + "units_current": 1369944, + "paths": 400, + "class": "observed", + "tokenizer": "runs/raw/lower/nomarks/unicode-17.0.0", + "queries": { + "L0": { + "terms": 1, + "postings": 108 + }, + "L3": { + "terms": 2, + "postings": 26949 + }, + "L6": { + "terms": 2, + "postings": 191032 + }, + "L8": { + "terms": 10, + "postings": 498437 + }, + "L11": { + "terms": 5, + "postings": 1337195 + }, + "L14": { + "terms": 10, + "postings": 1860446 + }, + "L17": { + "terms": 7, + "postings": 2671741 + }, + "L20": { + "terms": 9, + "postings": 3801316 + }, + "L23": { + "terms": 14, + "postings": 4966503 + }, + "L25": { + "terms": 19, + "postings": 6503751 + }, + "S0": { + "terms": 1, + "postings": 32 + }, + "S1": { + "terms": 3, + "postings": 1224831 + }, + "S2": { + "terms": 4, + "postings": 890406 + }, + "S3": { + "terms": 9, + "postings": 1378417 + }, + "S4": { + "terms": 12, + "postings": 3283060 + }, + "S5": { + "terms": 17, + "postings": 3338954 + } + }, + "shapes": { + "free-class": { + "queries": 16, + "median_of_warm_medians_s": 14.39258, + "min_s": 1.48684, + "max_s": 34.07941, + "load_1min_range": [ + 2.99, + 5.59 + ], + "per_query": { + "L0": { + "first_s": 14.64592, + "first_load_1min": 3.87, + "warm_median_s": 1.50197, + "warm_min_s": 1.49441, + "warm_max_s": 1.51846, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 1.49618, + "cpu_s": 1.49651, + "load_1min": 3.89 + }, + { + "wall_s": 1.49441, + "cpu_s": 1.49458, + "load_1min": 3.89 + }, + { + "wall_s": 1.50197, + "cpu_s": 1.50193, + "load_1min": 3.98 + }, + { + "wall_s": 1.51846, + "cpu_s": 1.51848, + "load_1min": 3.98 + }, + { + "wall_s": 1.50563, + "cpu_s": 1.50571, + "load_1min": 3.98 + } + ], + "stable": true, + "answer": "71417a323b7f309d" + }, + "L3": { + "first_s": 2.91324, + "first_load_1min": 4.14, + "warm_median_s": 2.91844, + "warm_min_s": 2.9104, + "warm_max_s": 2.92913, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 2.91844, + "cpu_s": 2.91887, + "load_1min": 4.14 + }, + { + "wall_s": 2.9228, + "cpu_s": 2.92286, + "load_1min": 4.21 + }, + { + "wall_s": 2.9104, + "cpu_s": 2.91071, + "load_1min": 4.21 + }, + { + "wall_s": 2.92913, + "cpu_s": 2.92904, + "load_1min": 4.11 + }, + { + "wall_s": 2.91491, + "cpu_s": 2.91542, + "load_1min": 4.11 + } + ], + "stable": true, + "answer": "3671f6681d39908b" + }, + "L6": { + "first_s": 3.37055, + "first_load_1min": 4.26, + "warm_median_s": 3.35921, + "warm_min_s": 3.3425, + "warm_max_s": 3.37523, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 3.35921, + "cpu_s": 3.35931, + "load_1min": 4.32 + }, + { + "wall_s": 3.3425, + "cpu_s": 3.34275, + "load_1min": 4.32 + }, + { + "wall_s": 3.37523, + "cpu_s": 3.37553, + "load_1min": 4.22 + }, + { + "wall_s": 3.37145, + "cpu_s": 3.36766, + "load_1min": 4.2 + }, + { + "wall_s": 3.35528, + "cpu_s": 3.35309, + "load_1min": 4.2 + } + ], + "stable": true, + "answer": "73b64c8a00b3b2ce" + }, + "L8": { + "first_s": 15.14747, + "first_load_1min": 4.1, + "warm_median_s": 15.12821, + "warm_min_s": 15.07086, + "warm_max_s": 15.21509, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 15.12821, + "cpu_s": 15.11916, + "load_1min": 4.1 + }, + { + "wall_s": 15.10212, + "cpu_s": 15.10219, + "load_1min": 4.08 + }, + { + "wall_s": 15.13216, + "cpu_s": 15.13254, + "load_1min": 4.48 + }, + { + "wall_s": 15.07086, + "cpu_s": 15.07214, + "load_1min": 4.54 + }, + { + "wall_s": 15.21509, + "cpu_s": 15.21032, + "load_1min": 4.32 + } + ], + "stable": true, + "answer": "6df6bf83f8dbf6e6" + }, + "L11": { + "first_s": 9.51879, + "first_load_1min": 4.46, + "warm_median_s": 9.54117, + "warm_min_s": 9.234, + "warm_max_s": 9.70994, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 9.54117, + "cpu_s": 9.53914, + "load_1min": 4.63 + }, + { + "wall_s": 9.70994, + "cpu_s": 9.70928, + "load_1min": 4.77 + }, + { + "wall_s": 9.54273, + "cpu_s": 9.52111, + "load_1min": 4.81 + }, + { + "wall_s": 9.44541, + "cpu_s": 9.44394, + "load_1min": 4.77 + }, + { + "wall_s": 9.234, + "cpu_s": 9.23691, + "load_1min": 4.5 + } + ], + "stable": true, + "answer": "5562995b852b99bc" + }, + "L14": { + "first_s": 17.45068, + "first_load_1min": 4.42, + "warm_median_s": 17.46473, + "warm_min_s": 17.40565, + "warm_max_s": 17.47711, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 17.40565, + "cpu_s": 17.40405, + "load_1min": 4.47 + }, + { + "wall_s": 17.46725, + "cpu_s": 17.46505, + "load_1min": 4.59 + }, + { + "wall_s": 17.43849, + "cpu_s": 17.43881, + "load_1min": 4.66 + }, + { + "wall_s": 17.46473, + "cpu_s": 17.46321, + "load_1min": 4.4 + }, + { + "wall_s": 17.47711, + "cpu_s": 17.47609, + "load_1min": 4.55 + } + ], + "stable": true, + "answer": "4832dbce59a93911" + }, + "L17": { + "first_s": 14.08641, + "first_load_1min": 4.2, + "warm_median_s": 13.65695, + "warm_min_s": 13.40994, + "warm_max_s": 13.92019, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 13.74632, + "cpu_s": 13.74893, + "load_1min": 4.22 + }, + { + "wall_s": 13.40994, + "cpu_s": 13.40866, + "load_1min": 3.87 + }, + { + "wall_s": 13.65695, + "cpu_s": 13.66164, + "load_1min": 3.7 + }, + { + "wall_s": 13.92019, + "cpu_s": 13.9155, + "load_1min": 4.06 + }, + { + "wall_s": 13.61908, + "cpu_s": 13.62425, + "load_1min": 3.82 + } + ], + "stable": true, + "answer": "f2ec600743c6563d" + }, + "L20": { + "first_s": 17.53859, + "first_load_1min": 3.62, + "warm_median_s": 26.08663, + "warm_min_s": 17.87892, + "warm_max_s": 33.08531, + "slowest_over_median": 1.27, + "passes": [ + { + "wall_s": 17.87892, + "cpu_s": 17.87848, + "load_1min": 3.4 + }, + { + "wall_s": 33.08531, + "cpu_s": 18.93857, + "load_1min": 3.75 + }, + { + "wall_s": 26.52002, + "cpu_s": 18.9552, + "load_1min": 4.25 + }, + { + "wall_s": 26.08663, + "cpu_s": 19.08248, + "load_1min": 4.64 + }, + { + "wall_s": 23.26903, + "cpu_s": 18.85745, + "load_1min": 4.62 + } + ], + "stable": true, + "answer": "f9c82dc7a44877fd" + }, + "L23": { + "first_s": 32.0329, + "first_load_1min": 4.91, + "warm_median_s": 32.27214, + "warm_min_s": 30.00364, + "warm_max_s": 38.55505, + "slowest_over_median": 1.19, + "passes": [ + { + "wall_s": 34.09009, + "cpu_s": 26.69955, + "load_1min": 5.43 + }, + { + "wall_s": 38.55505, + "cpu_s": 27.49581, + "load_1min": 5.56 + }, + { + "wall_s": 32.27214, + "cpu_s": 27.08689, + "load_1min": 5.17 + }, + { + "wall_s": 30.00364, + "cpu_s": 26.60909, + "load_1min": 5.27 + }, + { + "wall_s": 31.93925, + "cpu_s": 26.77795, + "load_1min": 5.47 + } + ], + "stable": true, + "answer": "f9cff73ec1dd0455" + }, + "L25": { + "first_s": 35.36602, + "first_load_1min": 5.59, + "warm_median_s": 34.07941, + "warm_min_s": 33.88893, + "warm_max_s": 34.39771, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 34.39771, + "cpu_s": 34.15981, + "load_1min": 4.89 + }, + { + "wall_s": 34.1036, + "cpu_s": 34.09282, + "load_1min": 4.46 + }, + { + "wall_s": 34.02257, + "cpu_s": 34.00926, + "load_1min": 4.37 + }, + { + "wall_s": 34.07941, + "cpu_s": 33.91745, + "load_1min": 4.4 + }, + { + "wall_s": 33.88893, + "cpu_s": 33.89499, + "load_1min": 4.63 + } + ], + "stable": true, + "answer": "70646b6616899176" + }, + "S0": { + "first_s": 1.46243, + "first_load_1min": 4.1, + "warm_median_s": 1.48684, + "warm_min_s": 1.45426, + "warm_max_s": 1.49668, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 1.48976, + "cpu_s": 1.49029, + "load_1min": 4.1 + }, + { + "wall_s": 1.48684, + "cpu_s": 1.48713, + "load_1min": 4.1 + }, + { + "wall_s": 1.46368, + "cpu_s": 1.46398, + "load_1min": 4.34 + }, + { + "wall_s": 1.45426, + "cpu_s": 1.45424, + "load_1min": 4.34 + }, + { + "wall_s": 1.49668, + "cpu_s": 1.49695, + "load_1min": 4.34 + } + ], + "stable": true, + "answer": "0d2cb0656ce580c7" + }, + "S1": { + "first_s": 6.34234, + "first_load_1min": 4.34, + "warm_median_s": 6.36522, + "warm_min_s": 6.34411, + "warm_max_s": 6.41118, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 6.35841, + "cpu_s": 6.35909, + "load_1min": 4.27 + }, + { + "wall_s": 6.36522, + "cpu_s": 6.36658, + "load_1min": 4.25 + }, + { + "wall_s": 6.41118, + "cpu_s": 6.41184, + "load_1min": 4.31 + }, + { + "wall_s": 6.34411, + "cpu_s": 6.34491, + "load_1min": 4.11 + }, + { + "wall_s": 6.36828, + "cpu_s": 6.36968, + "load_1min": 4.18 + } + ], + "stable": true, + "answer": "ebdf28564c404722" + }, + "S2": { + "first_s": 7.16312, + "first_load_1min": 4.17, + "warm_median_s": 7.13884, + "warm_min_s": 7.06714, + "warm_max_s": 7.20712, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 7.19963, + "cpu_s": 7.20013, + "load_1min": 4.08 + }, + { + "wall_s": 7.10266, + "cpu_s": 7.10349, + "load_1min": 4.14 + }, + { + "wall_s": 7.20712, + "cpu_s": 7.20717, + "load_1min": 3.97 + }, + { + "wall_s": 7.13884, + "cpu_s": 7.14073, + "load_1min": 3.83 + }, + { + "wall_s": 7.06714, + "cpu_s": 7.068, + "load_1min": 3.68 + } + ], + "stable": true, + "answer": "e291bf8af6f3ad65" + }, + "S3": { + "first_s": 14.90632, + "first_load_1min": 3.58, + "warm_median_s": 15.24119, + "warm_min_s": 14.97083, + "warm_max_s": 15.53565, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 15.16151, + "cpu_s": 14.95458, + "load_1min": 3.53 + }, + { + "wall_s": 15.41037, + "cpu_s": 14.95336, + "load_1min": 3.83 + }, + { + "wall_s": 15.53565, + "cpu_s": 14.87501, + "load_1min": 3.87 + }, + { + "wall_s": 15.24119, + "cpu_s": 14.85182, + "load_1min": 3.73 + }, + { + "wall_s": 14.97083, + "cpu_s": 14.8703, + "load_1min": 3.49 + } + ], + "stable": true, + "answer": "32ee6933a75f4cc5" + }, + "S4": { + "first_s": 22.99016, + "first_load_1min": 3.23, + "warm_median_s": 20.75642, + "warm_min_s": 20.53683, + "warm_max_s": 25.983, + "slowest_over_median": 1.25, + "passes": [ + { + "wall_s": 25.983, + "cpu_s": 21.93972, + "load_1min": 3.08 + }, + { + "wall_s": 21.65929, + "cpu_s": 21.65832, + "load_1min": 3.82 + }, + { + "wall_s": 20.75642, + "cpu_s": 20.765, + "load_1min": 4.31 + }, + { + "wall_s": 20.53683, + "cpu_s": 20.54564, + "load_1min": 4.17 + }, + { + "wall_s": 20.68028, + "cpu_s": 20.68709, + "load_1min": 3.78 + } + ], + "stable": true, + "answer": "3a8819936f0fa436" + }, + "S5": { + "first_s": 27.44719, + "first_load_1min": 3.75, + "warm_median_s": 27.77053, + "warm_min_s": 27.61143, + "warm_max_s": 28.72682, + "slowest_over_median": 1.03, + "passes": [ + { + "wall_s": 27.61143, + "cpu_s": 27.62221, + "load_1min": 3.14 + }, + { + "wall_s": 27.77053, + "cpu_s": 27.78151, + "load_1min": 3.04 + }, + { + "wall_s": 28.44569, + "cpu_s": 28.38538, + "load_1min": 2.99 + }, + { + "wall_s": 28.72682, + "cpu_s": 28.68728, + "load_1min": 3.38 + }, + { + "wall_s": 27.69303, + "cpu_s": 27.70521, + "load_1min": 4.08 + } + ], + "stable": true, + "answer": "38333b798f280324" + } + } + }, + "free-all": { + "queries": 16, + "median_of_warm_medians_s": 9.58295, + "min_s": 0.96906, + "max_s": 23.32028, + "load_1min_range": [ + 2.2, + 4.95 + ], + "per_query": { + "L0": { + "first_s": 0.98879, + "first_load_1min": 3.76, + "warm_median_s": 0.96906, + "warm_min_s": 0.96617, + "warm_max_s": 0.9862, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 0.97956, + "cpu_s": 0.98002, + "load_1min": 3.76 + }, + { + "wall_s": 0.96906, + "cpu_s": 0.96963, + "load_1min": 3.76 + }, + { + "wall_s": 0.96617, + "cpu_s": 0.96681, + "load_1min": 3.76 + }, + { + "wall_s": 0.96822, + "cpu_s": 0.96891, + "load_1min": 3.62 + }, + { + "wall_s": 0.9862, + "cpu_s": 0.98665, + "load_1min": 3.62 + } + ], + "stable": true, + "answer": "71417a323b7f309d" + }, + "L3": { + "first_s": 1.83377, + "first_load_1min": 3.62, + "warm_median_s": 1.85049, + "warm_min_s": 1.81446, + "warm_max_s": 1.85697, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 1.85433, + "cpu_s": 1.85554, + "load_1min": 3.62 + }, + { + "wall_s": 1.85049, + "cpu_s": 1.85141, + "load_1min": 3.57 + }, + { + "wall_s": 1.81446, + "cpu_s": 1.81559, + "load_1min": 3.57 + }, + { + "wall_s": 1.82239, + "cpu_s": 1.82339, + "load_1min": 3.57 + }, + { + "wall_s": 1.85697, + "cpu_s": 1.85792, + "load_1min": 3.69 + } + ], + "stable": true, + "answer": "3671f6681d39908b" + }, + "L6": { + "first_s": 2.16435, + "first_load_1min": 3.69, + "warm_median_s": 2.12049, + "warm_min_s": 2.11351, + "warm_max_s": 2.15917, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 2.15917, + "cpu_s": 2.16011, + "load_1min": 3.71 + }, + { + "wall_s": 2.12049, + "cpu_s": 2.12164, + "load_1min": 3.71 + }, + { + "wall_s": 2.11351, + "cpu_s": 2.11479, + "load_1min": 3.71 + }, + { + "wall_s": 2.15052, + "cpu_s": 2.1517, + "load_1min": 3.89 + }, + { + "wall_s": 2.11478, + "cpu_s": 2.11607, + "load_1min": 3.89 + } + ], + "stable": true, + "answer": "73b64c8a00b3b2ce" + }, + "L8": { + "first_s": 9.65471, + "first_load_1min": 3.74, + "warm_median_s": 9.93783, + "warm_min_s": 9.54137, + "warm_max_s": 10.08834, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 10.08834, + "cpu_s": 10.07757, + "load_1min": 3.85 + }, + { + "wall_s": 9.93783, + "cpu_s": 9.93805, + "load_1min": 3.95 + }, + { + "wall_s": 9.54137, + "cpu_s": 9.54595, + "load_1min": 3.96 + }, + { + "wall_s": 9.98672, + "cpu_s": 9.98522, + "load_1min": 4.05 + }, + { + "wall_s": 9.83633, + "cpu_s": 9.8386, + "load_1min": 4.19 + } + ], + "stable": true, + "answer": "6df6bf83f8dbf6e6" + }, + "L11": { + "first_s": 6.29707, + "first_load_1min": 4.17, + "warm_median_s": 6.30272, + "warm_min_s": 6.21779, + "warm_max_s": 6.58321, + "slowest_over_median": 1.04, + "passes": [ + { + "wall_s": 6.29063, + "cpu_s": 6.29301, + "load_1min": 4.23 + }, + { + "wall_s": 6.30272, + "cpu_s": 6.30606, + "load_1min": 4.29 + }, + { + "wall_s": 6.32947, + "cpu_s": 6.33293, + "load_1min": 4.26 + }, + { + "wall_s": 6.58321, + "cpu_s": 6.58584, + "load_1min": 4.14 + }, + { + "wall_s": 6.21779, + "cpu_s": 6.22129, + "load_1min": 4.13 + } + ], + "stable": true, + "answer": "5562995b852b99bc" + }, + "L14": { + "first_s": 11.2884, + "first_load_1min": 4.04, + "warm_median_s": 11.38369, + "warm_min_s": 11.28872, + "warm_max_s": 11.44349, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 11.36941, + "cpu_s": 11.37593, + "load_1min": 3.81 + }, + { + "wall_s": 11.28872, + "cpu_s": 11.29534, + "load_1min": 3.54 + }, + { + "wall_s": 11.43182, + "cpu_s": 11.4377, + "load_1min": 3.96 + }, + { + "wall_s": 11.38369, + "cpu_s": 11.38945, + "load_1min": 3.66 + }, + { + "wall_s": 11.44349, + "cpu_s": 11.41606, + "load_1min": 3.7 + } + ], + "stable": true, + "answer": "4832dbce59a93911" + }, + "L17": { + "first_s": 9.56872, + "first_load_1min": 3.7, + "warm_median_s": 9.51948, + "warm_min_s": 9.48838, + "warm_max_s": 9.57496, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 9.53466, + "cpu_s": 9.53936, + "load_1min": 3.58 + }, + { + "wall_s": 9.48996, + "cpu_s": 9.49526, + "load_1min": 3.45 + }, + { + "wall_s": 9.51948, + "cpu_s": 9.52462, + "load_1min": 3.45 + }, + { + "wall_s": 9.48838, + "cpu_s": 9.49359, + "load_1min": 3.39 + }, + { + "wall_s": 9.57496, + "cpu_s": 9.57281, + "load_1min": 3.18 + } + ], + "stable": true, + "answer": "f2ec600743c6563d" + }, + "L20": { + "first_s": 12.12694, + "first_load_1min": 3.22, + "warm_median_s": 12.07631, + "warm_min_s": 12.06361, + "warm_max_s": 12.13732, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 12.13732, + "cpu_s": 12.1435, + "load_1min": 3.18 + }, + { + "wall_s": 12.09843, + "cpu_s": 12.10417, + "load_1min": 3.14 + }, + { + "wall_s": 12.07631, + "cpu_s": 12.08321, + "load_1min": 2.89 + }, + { + "wall_s": 12.06361, + "cpu_s": 12.07022, + "load_1min": 2.84 + }, + { + "wall_s": 12.07138, + "cpu_s": 12.07824, + "load_1min": 2.56 + } + ], + "stable": true, + "answer": "f9c82dc7a44877fd" + }, + "L23": { + "first_s": 17.32375, + "first_load_1min": 2.82, + "warm_median_s": 17.30679, + "warm_min_s": 17.28679, + "warm_max_s": 17.3341, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 17.2905, + "cpu_s": 17.29848, + "load_1min": 2.58 + }, + { + "wall_s": 17.3341, + "cpu_s": 17.34277, + "load_1min": 2.7 + }, + { + "wall_s": 17.28679, + "cpu_s": 17.29606, + "load_1min": 3.07 + }, + { + "wall_s": 17.31849, + "cpu_s": 17.31393, + "load_1min": 2.76 + }, + { + "wall_s": 17.30679, + "cpu_s": 17.31579, + "load_1min": 2.69 + } + ], + "stable": true, + "answer": "f9cff73ec1dd0455" + }, + "L25": { + "first_s": 23.21785, + "first_load_1min": 2.55, + "warm_median_s": 23.32028, + "warm_min_s": 23.23396, + "warm_max_s": 23.72766, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 23.24269, + "cpu_s": 23.25372, + "load_1min": 2.57 + }, + { + "wall_s": 23.23396, + "cpu_s": 23.24622, + "load_1min": 2.65 + }, + { + "wall_s": 23.32028, + "cpu_s": 23.33258, + "load_1min": 2.89 + }, + { + "wall_s": 23.42908, + "cpu_s": 23.44109, + "load_1min": 3.27 + }, + { + "wall_s": 23.72766, + "cpu_s": 23.73722, + "load_1min": 4.55 + } + ], + "stable": true, + "answer": "70646b6616899176" + }, + "S0": { + "first_s": 0.99558, + "first_load_1min": 3.94, + "warm_median_s": 0.99011, + "warm_min_s": 0.9852, + "warm_max_s": 0.99867, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 0.99011, + "cpu_s": 0.99072, + "load_1min": 3.94 + }, + { + "wall_s": 0.99867, + "cpu_s": 0.99912, + "load_1min": 3.87 + }, + { + "wall_s": 0.98632, + "cpu_s": 0.98692, + "load_1min": 3.87 + }, + { + "wall_s": 0.99725, + "cpu_s": 0.99753, + "load_1min": 3.87 + }, + { + "wall_s": 0.9852, + "cpu_s": 0.98578, + "load_1min": 3.87 + } + ], + "stable": true, + "answer": "0d2cb0656ce580c7" + }, + "S1": { + "first_s": 4.56542, + "first_load_1min": 3.87, + "warm_median_s": 4.54805, + "warm_min_s": 4.51568, + "warm_max_s": 4.62021, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 4.54805, + "cpu_s": 4.55016, + "load_1min": 3.72 + }, + { + "wall_s": 4.55189, + "cpu_s": 4.55466, + "load_1min": 3.58 + }, + { + "wall_s": 4.62021, + "cpu_s": 4.60137, + "load_1min": 3.45 + }, + { + "wall_s": 4.53118, + "cpu_s": 4.53381, + "load_1min": 3.34 + }, + { + "wall_s": 4.51568, + "cpu_s": 4.51815, + "load_1min": 3.31 + } + ], + "stable": true, + "answer": "ebdf28564c404722" + }, + "S2": { + "first_s": 4.81166, + "first_load_1min": 3.12, + "warm_median_s": 4.81113, + "warm_min_s": 4.78382, + "warm_max_s": 4.82175, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 4.80523, + "cpu_s": 4.80792, + "load_1min": 2.95 + }, + { + "wall_s": 4.81113, + "cpu_s": 4.81336, + "load_1min": 2.88 + }, + { + "wall_s": 4.78382, + "cpu_s": 4.78654, + "load_1min": 2.81 + }, + { + "wall_s": 4.81793, + "cpu_s": 4.82086, + "load_1min": 2.82 + }, + { + "wall_s": 4.82175, + "cpu_s": 4.82438, + "load_1min": 3.0 + } + ], + "stable": true, + "answer": "e291bf8af6f3ad65" + }, + "S3": { + "first_s": 9.61503, + "first_load_1min": 2.83, + "warm_median_s": 9.64642, + "warm_min_s": 9.63314, + "warm_max_s": 9.65447, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 9.65447, + "cpu_s": 9.66016, + "load_1min": 2.55 + }, + { + "wall_s": 9.63314, + "cpu_s": 9.63818, + "load_1min": 2.46 + }, + { + "wall_s": 9.64206, + "cpu_s": 9.64738, + "load_1min": 2.34 + }, + { + "wall_s": 9.65444, + "cpu_s": 9.6596, + "load_1min": 2.28 + }, + { + "wall_s": 9.64642, + "cpu_s": 9.65214, + "load_1min": 2.33 + } + ], + "stable": true, + "answer": "32ee6933a75f4cc5" + }, + "S4": { + "first_s": 14.21902, + "first_load_1min": 2.2, + "warm_median_s": 14.27, + "warm_min_s": 14.2235, + "warm_max_s": 14.31387, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 14.27632, + "cpu_s": 14.28417, + "load_1min": 2.23 + }, + { + "wall_s": 14.2235, + "cpu_s": 14.23168, + "load_1min": 2.45 + }, + { + "wall_s": 14.27, + "cpu_s": 14.27796, + "load_1min": 2.58 + }, + { + "wall_s": 14.31387, + "cpu_s": 14.32189, + "load_1min": 2.61 + }, + { + "wall_s": 14.26367, + "cpu_s": 14.27152, + "load_1min": 2.51 + } + ], + "stable": true, + "answer": "3a8819936f0fa436" + }, + "S5": { + "first_s": 18.66108, + "first_load_1min": 3.75, + "warm_median_s": 18.63964, + "warm_min_s": 18.5955, + "warm_max_s": 18.65954, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 18.6086, + "cpu_s": 18.61941, + "load_1min": 4.95 + }, + { + "wall_s": 18.5955, + "cpu_s": 18.60602, + "load_1min": 4.59 + }, + { + "wall_s": 18.63964, + "cpu_s": 18.64952, + "load_1min": 3.79 + }, + { + "wall_s": 18.65034, + "cpu_s": 18.66037, + "load_1min": 3.23 + }, + { + "wall_s": 18.65954, + "cpu_s": 18.6698, + "load_1min": 2.99 + } + ], + "stable": true, + "answer": "38333b798f280324" + } + } + }, + "paths-scores": { + "queries": 5, + "median_of_warm_medians_s": 5.41238, + "min_s": 1.1936, + "max_s": 15.06381, + "load_1min_range": [ + 2.23, + 2.99 + ], + "per_query": { + "L0": { + "first_s": 1.20423, + "first_load_1min": 2.78, + "warm_median_s": 1.1936, + "warm_min_s": 1.18288, + "warm_max_s": 1.21831, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 1.18288, + "cpu_s": 1.18358, + "load_1min": 2.78 + }, + { + "wall_s": 1.19093, + "cpu_s": 1.19171, + "load_1min": 2.78 + }, + { + "wall_s": 1.20076, + "cpu_s": 1.2015, + "load_1min": 2.78 + }, + { + "wall_s": 1.21831, + "cpu_s": 1.21886, + "load_1min": 2.64 + }, + { + "wall_s": 1.1936, + "cpu_s": 1.19436, + "load_1min": 2.64 + } + ], + "stable": true, + "answer": "4f53cda18c2baa0c" + }, + "L6": { + "first_s": 2.24293, + "first_load_1min": 2.64, + "warm_median_s": 2.25064, + "warm_min_s": 2.23577, + "warm_max_s": 2.29294, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 2.29294, + "cpu_s": 2.29364, + "load_1min": 2.64 + }, + { + "wall_s": 2.25064, + "cpu_s": 2.25155, + "load_1min": 2.58 + }, + { + "wall_s": 2.25543, + "cpu_s": 2.25661, + "load_1min": 2.58 + }, + { + "wall_s": 2.24189, + "cpu_s": 2.24334, + "load_1min": 2.54 + }, + { + "wall_s": 2.23577, + "cpu_s": 2.23682, + "load_1min": 2.54 + } + ], + "stable": true, + "answer": "fbb18d5391251239" + }, + "L11": { + "first_s": 5.39018, + "first_load_1min": 2.41, + "warm_median_s": 5.41238, + "warm_min_s": 5.3944, + "warm_max_s": 5.43347, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 5.3944, + "cpu_s": 5.39743, + "load_1min": 2.62 + }, + { + "wall_s": 5.40396, + "cpu_s": 5.40712, + "load_1min": 2.73 + }, + { + "wall_s": 5.43347, + "cpu_s": 5.43635, + "load_1min": 2.99 + }, + { + "wall_s": 5.41495, + "cpu_s": 5.41817, + "load_1min": 2.91 + }, + { + "wall_s": 5.41238, + "cpu_s": 5.41564, + "load_1min": 2.76 + } + ], + "stable": true, + "answer": "c1852a5e85df4b1d" + }, + "L17": { + "first_s": 7.58261, + "first_load_1min": 2.78, + "warm_median_s": 7.60735, + "warm_min_s": 7.59321, + "warm_max_s": 7.61379, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 7.59321, + "cpu_s": 7.59664, + "load_1min": 2.81 + }, + { + "wall_s": 7.60735, + "cpu_s": 7.61163, + "load_1min": 2.66 + }, + { + "wall_s": 7.60426, + "cpu_s": 7.60818, + "load_1min": 2.73 + }, + { + "wall_s": 7.61202, + "cpu_s": 7.6166, + "load_1min": 2.59 + }, + { + "wall_s": 7.61379, + "cpu_s": 7.61825, + "load_1min": 2.5 + } + ], + "stable": true, + "answer": "fc5ddb623b636ebc" + }, + "L23": { + "first_s": 15.04958, + "first_load_1min": 2.38, + "warm_median_s": 15.06381, + "warm_min_s": 15.01496, + "warm_max_s": 15.11244, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 15.06381, + "cpu_s": 15.06028, + "load_1min": 2.38 + }, + { + "wall_s": 15.07074, + "cpu_s": 15.07924, + "load_1min": 2.38 + }, + { + "wall_s": 15.01496, + "cpu_s": 15.02342, + "load_1min": 2.28 + }, + { + "wall_s": 15.11244, + "cpu_s": 15.12102, + "load_1min": 2.23 + }, + { + "wall_s": 15.03821, + "cpu_s": 15.04702, + "load_1min": 2.24 + } + ], + "stable": true, + "answer": "84ae68b25529f27f" + } + } + }, + "paths-search": { + "queries": 5, + "median_of_warm_medians_s": 5.39487, + "min_s": 1.19996, + "max_s": 15.04189, + "load_1min_range": [ + 1.91, + 2.63 + ], + "per_query": { + "L0": { + "first_s": 1.2028, + "first_load_1min": 2.47, + "warm_median_s": 1.19996, + "warm_min_s": 1.19664, + "warm_max_s": 1.20536, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 1.20374, + "cpu_s": 1.20442, + "load_1min": 2.35 + }, + { + "wall_s": 1.20536, + "cpu_s": 1.20588, + "load_1min": 2.35 + }, + { + "wall_s": 1.1981, + "cpu_s": 1.19889, + "load_1min": 2.35 + }, + { + "wall_s": 1.19664, + "cpu_s": 1.19688, + "load_1min": 2.35 + }, + { + "wall_s": 1.19996, + "cpu_s": 1.20063, + "load_1min": 2.57 + } + ], + "stable": true, + "answer": "4f53cda18c2baa0c" + }, + "L6": { + "first_s": 2.26868, + "first_load_1min": 2.57, + "warm_median_s": 2.25086, + "warm_min_s": 2.24482, + "warm_max_s": 2.26059, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 2.25086, + "cpu_s": 2.25221, + "load_1min": 2.57 + }, + { + "wall_s": 2.24482, + "cpu_s": 2.24592, + "load_1min": 2.6 + }, + { + "wall_s": 2.25047, + "cpu_s": 2.2519, + "load_1min": 2.6 + }, + { + "wall_s": 2.25609, + "cpu_s": 2.25746, + "load_1min": 2.63 + }, + { + "wall_s": 2.26059, + "cpu_s": 2.26188, + "load_1min": 2.63 + } + ], + "stable": true, + "answer": "34c3fc5d495f9373" + }, + "L11": { + "first_s": 5.50046, + "first_load_1min": 2.63, + "warm_median_s": 5.39487, + "warm_min_s": 5.37209, + "warm_max_s": 5.42807, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 5.42807, + "cpu_s": 5.4311, + "load_1min": 2.61 + }, + { + "wall_s": 5.37209, + "cpu_s": 5.37511, + "load_1min": 2.48 + }, + { + "wall_s": 5.39755, + "cpu_s": 5.40069, + "load_1min": 2.52 + }, + { + "wall_s": 5.38461, + "cpu_s": 5.38756, + "load_1min": 2.56 + }, + { + "wall_s": 5.39487, + "cpu_s": 5.39795, + "load_1min": 2.43 + } + ], + "stable": true, + "answer": "a02d8d72fe9fc718" + }, + "L17": { + "first_s": 7.61214, + "first_load_1min": 2.4, + "warm_median_s": 7.61282, + "warm_min_s": 7.59799, + "warm_max_s": 7.70641, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 7.63785, + "cpu_s": 7.6423, + "load_1min": 2.29 + }, + { + "wall_s": 7.59821, + "cpu_s": 7.60231, + "load_1min": 2.17 + }, + { + "wall_s": 7.61282, + "cpu_s": 7.61699, + "load_1min": 2.3 + }, + { + "wall_s": 7.59799, + "cpu_s": 7.60198, + "load_1min": 2.2 + }, + { + "wall_s": 7.70641, + "cpu_s": 7.71014, + "load_1min": 2.4 + } + ], + "stable": true, + "answer": "35449edca71ade6a" + }, + "L23": { + "first_s": 15.0446, + "first_load_1min": 2.45, + "warm_median_s": 15.04189, + "warm_min_s": 14.98712, + "warm_max_s": 15.08749, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 15.04189, + "cpu_s": 15.05015, + "load_1min": 2.2 + }, + { + "wall_s": 15.08749, + "cpu_s": 15.09579, + "load_1min": 2.08 + }, + { + "wall_s": 15.03535, + "cpu_s": 15.0445, + "load_1min": 2.0 + }, + { + "wall_s": 14.98712, + "cpu_s": 14.99545, + "load_1min": 2.08 + }, + { + "wall_s": 15.04587, + "cpu_s": 15.05444, + "load_1min": 1.91 + } + ], + "stable": true, + "answer": "2244045ae40dfaf0" + } + } + } + }, + "fresh": { + "free-class/L0": { + "query_s": [ + 1.42963, + 1.43435, + 1.41148 + ], + "open_s": [ + 0.00055, + 0.00058, + 0.00056 + ], + "peak_rss_mb": [ + 70.4, + 69.8, + 70.8 + ], + "load_1min": [ + 2.22, + 2.37, + 2.37 + ], + "answers": [ + "71417a323b7f309d" + ], + "errors": 0 + }, + "free-class/L11": { + "query_s": [ + 8.77224, + 8.84208, + 8.84647 + ], + "open_s": [ + 0.00056, + 0.00057, + 0.00059 + ], + "peak_rss_mb": [ + 447.6, + 447.0, + 447.8 + ], + "load_1min": [ + 2.37, + 2.3, + 2.55 + ], + "answers": [ + "5562995b852b99bc" + ], + "errors": 0 + }, + "free-class/L23": { + "query_s": [ + 23.98776, + 24.24916, + 24.2118 + ], + "open_s": [ + 0.00059, + 0.00059, + 0.0006 + ], + "peak_rss_mb": [ + 468.7, + 467.8, + 469.1 + ], + "load_1min": [ + 2.68, + 2.52, + 3.14 + ], + "answers": [ + "f9cff73ec1dd0455" + ], + "errors": 0 + }, + "paths-scores/L0": { + "query_s": [ + 1.1879, + 1.1873, + 1.209 + ], + "open_s": [ + 0.00064, + 0.0006, + 0.00058 + ], + "peak_rss_mb": [ + 70.0, + 70.7, + 71.6 + ], + "load_1min": [ + 3.15, + 3.15, + 3.15 + ], + "answers": [ + "4f53cda18c2baa0c" + ], + "errors": 0 + }, + "paths-scores/L11": { + "query_s": [ + 5.40828, + 5.42363, + 5.39611 + ], + "open_s": [ + 0.00059, + 0.00054, + 0.0006 + ], + "peak_rss_mb": [ + 71.2, + 71.3, + 71.2 + ], + "load_1min": [ + 2.97, + 3.06, + 3.13 + ], + "answers": [ + "c1852a5e85df4b1d" + ], + "errors": 0 + }, + "paths-scores/L23": { + "query_s": [ + 15.07858, + 15.04138, + 15.12317 + ], + "open_s": [ + 0.00058, + 0.00062, + 0.00063 + ], + "peak_rss_mb": [ + 70.7, + 71.2, + 70.9 + ], + "load_1min": [ + 2.96, + 2.59, + 2.53 + ], + "answers": [ + "84ae68b25529f27f" + ], + "errors": 0 + } + } + }, + "after": { + "open_s": 0.00139, + "open_load_1min": 3.04, + "units_current": 1369944, + "paths": 400, + "class": "observed", + "tokenizer": "runs/raw/lower/nomarks/unicode-17.0.0", + "queries": { + "L0": { + "terms": 1, + "postings": 108 + }, + "L3": { + "terms": 2, + "postings": 26949 + }, + "L6": { + "terms": 2, + "postings": 191032 + }, + "L8": { + "terms": 10, + "postings": 498437 + }, + "L11": { + "terms": 5, + "postings": 1337195 + }, + "L14": { + "terms": 10, + "postings": 1860446 + }, + "L17": { + "terms": 7, + "postings": 2671741 + }, + "L20": { + "terms": 9, + "postings": 3801316 + }, + "L23": { + "terms": 14, + "postings": 4966503 + }, + "L25": { + "terms": 19, + "postings": 6503751 + }, + "S0": { + "terms": 1, + "postings": 32 + }, + "S1": { + "terms": 3, + "postings": 1224831 + }, + "S2": { + "terms": 4, + "postings": 890406 + }, + "S3": { + "terms": 9, + "postings": 1378417 + }, + "S4": { + "terms": 12, + "postings": 3283060 + }, + "S5": { + "terms": 17, + "postings": 3338954 + } + }, + "shapes": { + "free-class": { + "queries": 16, + "median_of_warm_medians_s": 1.20328, + "min_s": 8e-05, + "max_s": 6.16522, + "load_1min_range": [ + 2.73, + 3.75 + ], + "per_query": { + "L0": { + "first_s": 0.00935, + "first_load_1min": 3.03, + "warm_median_s": 0.00012, + "warm_min_s": 0.00011, + "warm_max_s": 0.00023, + "slowest_over_median": 2.01, + "passes": [ + { + "wall_s": 0.00023, + "cpu_s": 0.00024, + "load_1min": 3.03 + }, + { + "wall_s": 0.00014, + "cpu_s": 0.00014, + "load_1min": 3.03 + }, + { + "wall_s": 0.00012, + "cpu_s": 0.00012, + "load_1min": 3.03 + }, + { + "wall_s": 0.00011, + "cpu_s": 0.00011, + "load_1min": 3.03 + }, + { + "wall_s": 0.00011, + "cpu_s": 0.00011, + "load_1min": 3.03 + } + ], + "stable": true, + "answer": "71417a323b7f309d" + }, + "L3": { + "first_s": 0.96846, + "first_load_1min": 3.03, + "warm_median_s": 0.0223, + "warm_min_s": 0.02159, + "warm_max_s": 0.02293, + "slowest_over_median": 1.03, + "passes": [ + { + "wall_s": 0.0223, + "cpu_s": 0.02232, + "load_1min": 3.03 + }, + { + "wall_s": 0.02235, + "cpu_s": 0.02237, + "load_1min": 3.03 + }, + { + "wall_s": 0.02159, + "cpu_s": 0.02161, + "load_1min": 3.03 + }, + { + "wall_s": 0.02293, + "cpu_s": 0.02296, + "load_1min": 3.03 + }, + { + "wall_s": 0.02204, + "cpu_s": 0.02207, + "load_1min": 3.03 + } + ], + "stable": true, + "answer": "3671f6681d39908b" + }, + "L6": { + "first_s": 3.43157, + "first_load_1min": 3.03, + "warm_median_s": 0.16531, + "warm_min_s": 0.16457, + "warm_max_s": 0.17082, + "slowest_over_median": 1.03, + "passes": [ + { + "wall_s": 0.16531, + "cpu_s": 0.16398, + "load_1min": 2.87 + }, + { + "wall_s": 0.16521, + "cpu_s": 0.16451, + "load_1min": 2.87 + }, + { + "wall_s": 0.167, + "cpu_s": 0.16624, + "load_1min": 2.87 + }, + { + "wall_s": 0.17082, + "cpu_s": 0.17011, + "load_1min": 2.87 + }, + { + "wall_s": 0.16457, + "cpu_s": 0.16386, + "load_1min": 2.87 + } + ], + "stable": true, + "answer": "73b64c8a00b3b2ce" + }, + "L8": { + "first_s": 2.79511, + "first_load_1min": 2.87, + "warm_median_s": 0.63077, + "warm_min_s": 0.6242, + "warm_max_s": 0.6456, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 0.6242, + "cpu_s": 0.62377, + "load_1min": 2.8 + }, + { + "wall_s": 0.6247, + "cpu_s": 0.62411, + "load_1min": 2.8 + }, + { + "wall_s": 0.63077, + "cpu_s": 0.63055, + "load_1min": 2.8 + }, + { + "wall_s": 0.63948, + "cpu_s": 0.63515, + "load_1min": 2.8 + }, + { + "wall_s": 0.6456, + "cpu_s": 0.64502, + "load_1min": 2.8 + } + ], + "stable": true, + "answer": "6df6bf83f8dbf6e6" + }, + "L11": { + "first_s": 1.08231, + "first_load_1min": 2.8, + "warm_median_s": 1.03561, + "warm_min_s": 1.029, + "warm_max_s": 1.04134, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 1.029, + "cpu_s": 1.02788, + "load_1min": 2.73 + }, + { + "wall_s": 1.02985, + "cpu_s": 1.0293, + "load_1min": 2.73 + }, + { + "wall_s": 1.04134, + "cpu_s": 1.03765, + "load_1min": 2.73 + }, + { + "wall_s": 1.03561, + "cpu_s": 1.03404, + "load_1min": 2.73 + }, + { + "wall_s": 1.03945, + "cpu_s": 1.03351, + "load_1min": 2.91 + } + ], + "stable": true, + "answer": "5562995b852b99bc" + }, + "L14": { + "first_s": 1.83831, + "first_load_1min": 2.91, + "warm_median_s": 1.84196, + "warm_min_s": 1.81912, + "warm_max_s": 1.84873, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 1.8482, + "cpu_s": 1.84331, + "load_1min": 2.91 + }, + { + "wall_s": 1.84873, + "cpu_s": 1.84806, + "load_1min": 2.91 + }, + { + "wall_s": 1.84196, + "cpu_s": 1.83776, + "load_1min": 2.84 + }, + { + "wall_s": 1.82003, + "cpu_s": 1.81476, + "load_1min": 2.84 + }, + { + "wall_s": 1.81912, + "cpu_s": 1.81043, + "load_1min": 2.93 + } + ], + "stable": true, + "answer": "4832dbce59a93911" + }, + "L17": { + "first_s": 2.07167, + "first_load_1min": 2.93, + "warm_median_s": 2.07798, + "warm_min_s": 2.05362, + "warm_max_s": 2.10811, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 2.10811, + "cpu_s": 2.10212, + "load_1min": 2.93 + }, + { + "wall_s": 2.07798, + "cpu_s": 2.07416, + "load_1min": 2.94 + }, + { + "wall_s": 2.0587, + "cpu_s": 2.05528, + "load_1min": 2.94 + }, + { + "wall_s": 2.05362, + "cpu_s": 2.0463, + "load_1min": 2.94 + }, + { + "wall_s": 2.09202, + "cpu_s": 2.09114, + "load_1min": 2.94 + } + ], + "stable": true, + "answer": "f2ec600743c6563d" + }, + "L20": { + "first_s": 2.86706, + "first_load_1min": 2.94, + "warm_median_s": 2.89412, + "warm_min_s": 2.86891, + "warm_max_s": 3.13059, + "slowest_over_median": 1.08, + "passes": [ + { + "wall_s": 2.86891, + "cpu_s": 2.86569, + "load_1min": 3.03 + }, + { + "wall_s": 2.87367, + "cpu_s": 2.86329, + "load_1min": 2.94 + }, + { + "wall_s": 3.13059, + "cpu_s": 3.12097, + "load_1min": 2.94 + }, + { + "wall_s": 3.03158, + "cpu_s": 3.00229, + "load_1min": 3.11 + }, + { + "wall_s": 2.89412, + "cpu_s": 2.86975, + "load_1min": 3.11 + } + ], + "stable": true, + "answer": "f9c82dc7a44877fd" + }, + "L23": { + "first_s": 4.16949, + "first_load_1min": 3.18, + "warm_median_s": 4.22215, + "warm_min_s": 4.21221, + "warm_max_s": 4.22998, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 4.22998, + "cpu_s": 4.23015, + "load_1min": 3.09 + }, + { + "wall_s": 4.22215, + "cpu_s": 4.22192, + "load_1min": 3.16 + }, + { + "wall_s": 4.21328, + "cpu_s": 4.21399, + "load_1min": 3.16 + }, + { + "wall_s": 4.22993, + "cpu_s": 4.22965, + "load_1min": 3.31 + }, + { + "wall_s": 4.21221, + "cpu_s": 4.20239, + "load_1min": 3.28 + } + ], + "stable": true, + "answer": "f9cff73ec1dd0455" + }, + "L25": { + "first_s": 5.9037, + "first_load_1min": 3.18, + "warm_median_s": 6.16522, + "warm_min_s": 6.0038, + "warm_max_s": 6.18275, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 6.0038, + "cpu_s": 5.99907, + "load_1min": 3.48 + }, + { + "wall_s": 6.16522, + "cpu_s": 6.14175, + "load_1min": 3.44 + }, + { + "wall_s": 6.18088, + "cpu_s": 6.16872, + "load_1min": 3.44 + }, + { + "wall_s": 6.13727, + "cpu_s": 6.12036, + "load_1min": 3.73 + }, + { + "wall_s": 6.18275, + "cpu_s": 6.17427, + "load_1min": 3.75 + } + ], + "stable": true, + "answer": "70646b6616899176" + }, + "S0": { + "first_s": 0.0009, + "first_load_1min": 3.53, + "warm_median_s": 8e-05, + "warm_min_s": 7e-05, + "warm_max_s": 0.0001, + "slowest_over_median": 1.23, + "passes": [ + { + "wall_s": 0.0001, + "cpu_s": 0.0001, + "load_1min": 3.53 + }, + { + "wall_s": 8e-05, + "cpu_s": 9e-05, + "load_1min": 3.53 + }, + { + "wall_s": 8e-05, + "cpu_s": 9e-05, + "load_1min": 3.53 + }, + { + "wall_s": 9e-05, + "cpu_s": 9e-05, + "load_1min": 3.53 + }, + { + "wall_s": 7e-05, + "cpu_s": 8e-05, + "load_1min": 3.53 + } + ], + "stable": true, + "answer": "0d2cb0656ce580c7" + }, + "S1": { + "first_s": 0.84777, + "first_load_1min": 3.53, + "warm_median_s": 0.88036, + "warm_min_s": 0.83455, + "warm_max_s": 0.8973, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 0.88036, + "cpu_s": 0.87347, + "load_1min": 3.53 + }, + { + "wall_s": 0.8973, + "cpu_s": 0.87357, + "load_1min": 3.41 + }, + { + "wall_s": 0.89358, + "cpu_s": 0.85655, + "load_1min": 3.41 + }, + { + "wall_s": 0.84352, + "cpu_s": 0.84195, + "load_1min": 3.41 + }, + { + "wall_s": 0.83455, + "cpu_s": 0.83408, + "load_1min": 3.41 + } + ], + "stable": true, + "answer": "ebdf28564c404722" + }, + "S2": { + "first_s": 0.71977, + "first_load_1min": 3.41, + "warm_median_s": 0.70676, + "warm_min_s": 0.68951, + "warm_max_s": 0.7085, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 0.70324, + "cpu_s": 0.70291, + "load_1min": 3.41 + }, + { + "wall_s": 0.7085, + "cpu_s": 0.70643, + "load_1min": 3.29 + }, + { + "wall_s": 0.70676, + "cpu_s": 0.70417, + "load_1min": 3.29 + }, + { + "wall_s": 0.70822, + "cpu_s": 0.70639, + "load_1min": 3.29 + }, + { + "wall_s": 0.68951, + "cpu_s": 0.68951, + "load_1min": 3.29 + } + ], + "stable": true, + "answer": "e291bf8af6f3ad65" + }, + "S3": { + "first_s": 1.38392, + "first_load_1min": 3.29, + "warm_median_s": 1.37094, + "warm_min_s": 1.36605, + "warm_max_s": 1.37209, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 1.37209, + "cpu_s": 1.372, + "load_1min": 3.29 + }, + { + "wall_s": 1.36605, + "cpu_s": 1.365, + "load_1min": 3.19 + }, + { + "wall_s": 1.37094, + "cpu_s": 1.3679, + "load_1min": 3.19 + }, + { + "wall_s": 1.37026, + "cpu_s": 1.36968, + "load_1min": 3.19 + }, + { + "wall_s": 1.3718, + "cpu_s": 1.37167, + "load_1min": 3.09 + } + ], + "stable": true, + "answer": "32ee6933a75f4cc5" + }, + "S4": { + "first_s": 2.94595, + "first_load_1min": 3.09, + "warm_median_s": 2.95016, + "warm_min_s": 2.85184, + "warm_max_s": 3.05217, + "slowest_over_median": 1.03, + "passes": [ + { + "wall_s": 2.95016, + "cpu_s": 2.94666, + "load_1min": 3.09 + }, + { + "wall_s": 2.96585, + "cpu_s": 2.95599, + "load_1min": 3.25 + }, + { + "wall_s": 3.05217, + "cpu_s": 2.91402, + "load_1min": 3.63 + }, + { + "wall_s": 2.85347, + "cpu_s": 2.85225, + "load_1min": 3.63 + }, + { + "wall_s": 2.85184, + "cpu_s": 2.84849, + "load_1min": 3.58 + } + ], + "stable": true, + "answer": "3a8819936f0fa436" + }, + "S5": { + "first_s": 3.51027, + "first_load_1min": 3.58, + "warm_median_s": 3.49208, + "warm_min_s": 3.46658, + "warm_max_s": 3.49882, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 3.49208, + "cpu_s": 3.48611, + "load_1min": 3.53 + }, + { + "wall_s": 3.46658, + "cpu_s": 3.46603, + "load_1min": 3.65 + }, + { + "wall_s": 3.49882, + "cpu_s": 3.49822, + "load_1min": 3.65 + }, + { + "wall_s": 3.49551, + "cpu_s": 3.49206, + "load_1min": 3.52 + }, + { + "wall_s": 3.48465, + "cpu_s": 3.48365, + "load_1min": 3.71 + } + ], + "stable": true, + "answer": "38333b798f280324" + } + } + }, + "free-all": { + "queries": 16, + "median_of_warm_medians_s": 1.16084, + "min_s": 7e-05, + "max_s": 5.77807, + "load_1min_range": [ + 2.69, + 3.66 + ], + "per_query": { + "L0": { + "first_s": 0.00043, + "first_load_1min": 3.66, + "warm_median_s": 0.00011, + "warm_min_s": 0.00011, + "warm_max_s": 0.00012, + "slowest_over_median": 1.13, + "passes": [ + { + "wall_s": 0.00012, + "cpu_s": 0.00013, + "load_1min": 3.66 + }, + { + "wall_s": 0.00011, + "cpu_s": 0.00012, + "load_1min": 3.66 + }, + { + "wall_s": 0.00011, + "cpu_s": 0.00011, + "load_1min": 3.66 + }, + { + "wall_s": 0.00011, + "cpu_s": 0.00011, + "load_1min": 3.66 + }, + { + "wall_s": 0.00011, + "cpu_s": 0.00011, + "load_1min": 3.66 + } + ], + "stable": true, + "answer": "71417a323b7f309d" + }, + "L3": { + "first_s": 0.02283, + "first_load_1min": 3.66, + "warm_median_s": 0.02214, + "warm_min_s": 0.02143, + "warm_max_s": 0.02279, + "slowest_over_median": 1.03, + "passes": [ + { + "wall_s": 0.02189, + "cpu_s": 0.02192, + "load_1min": 3.66 + }, + { + "wall_s": 0.02279, + "cpu_s": 0.02282, + "load_1min": 3.66 + }, + { + "wall_s": 0.02236, + "cpu_s": 0.02239, + "load_1min": 3.66 + }, + { + "wall_s": 0.02143, + "cpu_s": 0.02146, + "load_1min": 3.66 + }, + { + "wall_s": 0.02214, + "cpu_s": 0.02215, + "load_1min": 3.66 + } + ], + "stable": true, + "answer": "3671f6681d39908b" + }, + "L6": { + "first_s": 0.16965, + "first_load_1min": 3.66, + "warm_median_s": 0.16902, + "warm_min_s": 0.16803, + "warm_max_s": 0.17493, + "slowest_over_median": 1.03, + "passes": [ + { + "wall_s": 0.16803, + "cpu_s": 0.1674, + "load_1min": 3.66 + }, + { + "wall_s": 0.16877, + "cpu_s": 0.16849, + "load_1min": 3.66 + }, + { + "wall_s": 0.16902, + "cpu_s": 0.16873, + "load_1min": 3.66 + }, + { + "wall_s": 0.17493, + "cpu_s": 0.17428, + "load_1min": 3.66 + }, + { + "wall_s": 0.17441, + "cpu_s": 0.17407, + "load_1min": 3.66 + } + ], + "stable": true, + "answer": "73b64c8a00b3b2ce" + }, + "L8": { + "first_s": 0.61926, + "first_load_1min": 3.66, + "warm_median_s": 0.60763, + "warm_min_s": 0.60338, + "warm_max_s": 0.61007, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 0.60763, + "cpu_s": 0.6072, + "load_1min": 3.66 + }, + { + "wall_s": 0.6035, + "cpu_s": 0.60176, + "load_1min": 3.66 + }, + { + "wall_s": 0.60338, + "cpu_s": 0.60314, + "load_1min": 3.66 + }, + { + "wall_s": 0.61007, + "cpu_s": 0.61014, + "load_1min": 3.66 + }, + { + "wall_s": 0.60916, + "cpu_s": 0.60634, + "load_1min": 3.66 + } + ], + "stable": true, + "answer": "6df6bf83f8dbf6e6" + }, + "L11": { + "first_s": 0.993, + "first_load_1min": 3.66, + "warm_median_s": 0.99416, + "warm_min_s": 0.98695, + "warm_max_s": 1.03401, + "slowest_over_median": 1.04, + "passes": [ + { + "wall_s": 0.99249, + "cpu_s": 0.98979, + "load_1min": 3.52 + }, + { + "wall_s": 1.03401, + "cpu_s": 1.01504, + "load_1min": 3.52 + }, + { + "wall_s": 0.99416, + "cpu_s": 0.99011, + "load_1min": 3.52 + }, + { + "wall_s": 1.00415, + "cpu_s": 1.00129, + "load_1min": 3.52 + }, + { + "wall_s": 0.98695, + "cpu_s": 0.97951, + "load_1min": 3.52 + } + ], + "stable": true, + "answer": "5562995b852b99bc" + }, + "L14": { + "first_s": 1.7824, + "first_load_1min": 3.48, + "warm_median_s": 1.77397, + "warm_min_s": 1.75861, + "warm_max_s": 1.78503, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 1.78062, + "cpu_s": 1.77982, + "load_1min": 3.48 + }, + { + "wall_s": 1.75861, + "cpu_s": 1.75775, + "load_1min": 3.48 + }, + { + "wall_s": 1.78503, + "cpu_s": 1.78408, + "load_1min": 3.36 + }, + { + "wall_s": 1.76717, + "cpu_s": 1.76636, + "load_1min": 3.36 + }, + { + "wall_s": 1.77397, + "cpu_s": 1.7735, + "load_1min": 3.36 + } + ], + "stable": true, + "answer": "4832dbce59a93911" + }, + "L17": { + "first_s": 2.02445, + "first_load_1min": 3.41, + "warm_median_s": 1.99156, + "warm_min_s": 1.98108, + "warm_max_s": 2.01321, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 2.01321, + "cpu_s": 2.01172, + "load_1min": 3.41 + }, + { + "wall_s": 1.99156, + "cpu_s": 1.98768, + "load_1min": 3.54 + }, + { + "wall_s": 1.98108, + "cpu_s": 1.97881, + "load_1min": 3.54 + }, + { + "wall_s": 2.00127, + "cpu_s": 1.99957, + "load_1min": 3.54 + }, + { + "wall_s": 1.98611, + "cpu_s": 1.9842, + "load_1min": 3.34 + } + ], + "stable": true, + "answer": "f2ec600743c6563d" + }, + "L20": { + "first_s": 2.77302, + "first_load_1min": 3.34, + "warm_median_s": 2.77243, + "warm_min_s": 2.76373, + "warm_max_s": 2.79266, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 2.76373, + "cpu_s": 2.75977, + "load_1min": 3.39 + }, + { + "wall_s": 2.77319, + "cpu_s": 2.77103, + "load_1min": 3.39 + }, + { + "wall_s": 2.77044, + "cpu_s": 2.76728, + "load_1min": 3.36 + }, + { + "wall_s": 2.77243, + "cpu_s": 2.76982, + "load_1min": 3.36 + }, + { + "wall_s": 2.79266, + "cpu_s": 2.79082, + "load_1min": 3.17 + } + ], + "stable": true, + "answer": "f9c82dc7a44877fd" + }, + "L23": { + "first_s": 4.00595, + "first_load_1min": 3.08, + "warm_median_s": 4.02386, + "warm_min_s": 4.00382, + "warm_max_s": 4.04629, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 4.01419, + "cpu_s": 4.01068, + "load_1min": 3.08 + }, + { + "wall_s": 4.02805, + "cpu_s": 4.02164, + "load_1min": 3.07 + }, + { + "wall_s": 4.02386, + "cpu_s": 4.02164, + "load_1min": 2.98 + }, + { + "wall_s": 4.04629, + "cpu_s": 4.04277, + "load_1min": 2.82 + }, + { + "wall_s": 4.00382, + "cpu_s": 3.99737, + "load_1min": 2.92 + } + ], + "stable": true, + "answer": "f9cff73ec1dd0455" + }, + "L25": { + "first_s": 5.72556, + "first_load_1min": 2.92, + "warm_median_s": 5.77807, + "warm_min_s": 5.7463, + "warm_max_s": 5.78497, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 5.7691, + "cpu_s": 5.76515, + "load_1min": 2.84 + }, + { + "wall_s": 5.77807, + "cpu_s": 5.77401, + "load_1min": 3.11 + }, + { + "wall_s": 5.78296, + "cpu_s": 5.74992, + "load_1min": 3.02 + }, + { + "wall_s": 5.78497, + "cpu_s": 5.75047, + "load_1min": 2.94 + }, + { + "wall_s": 5.7463, + "cpu_s": 5.73751, + "load_1min": 3.1 + } + ], + "stable": true, + "answer": "70646b6616899176" + }, + "S0": { + "first_s": 0.00022, + "first_load_1min": 3.09, + "warm_median_s": 7e-05, + "warm_min_s": 7e-05, + "warm_max_s": 9e-05, + "slowest_over_median": 1.24, + "passes": [ + { + "wall_s": 9e-05, + "cpu_s": 9e-05, + "load_1min": 3.09 + }, + { + "wall_s": 8e-05, + "cpu_s": 8e-05, + "load_1min": 3.09 + }, + { + "wall_s": 7e-05, + "cpu_s": 7e-05, + "load_1min": 3.09 + }, + { + "wall_s": 7e-05, + "cpu_s": 7e-05, + "load_1min": 3.09 + }, + { + "wall_s": 7e-05, + "cpu_s": 7e-05, + "load_1min": 3.09 + } + ], + "stable": true, + "answer": "0d2cb0656ce580c7" + }, + "S1": { + "first_s": 0.79709, + "first_load_1min": 3.09, + "warm_median_s": 0.7886, + "warm_min_s": 0.78696, + "warm_max_s": 0.80128, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 0.7886, + "cpu_s": 0.78737, + "load_1min": 3.09 + }, + { + "wall_s": 0.80128, + "cpu_s": 0.79996, + "load_1min": 2.93 + }, + { + "wall_s": 0.78848, + "cpu_s": 0.78705, + "load_1min": 2.93 + }, + { + "wall_s": 0.78696, + "cpu_s": 0.78484, + "load_1min": 2.93 + }, + { + "wall_s": 0.78953, + "cpu_s": 0.78566, + "load_1min": 2.93 + } + ], + "stable": true, + "answer": "ebdf28564c404722" + }, + "S2": { + "first_s": 0.6651, + "first_load_1min": 2.93, + "warm_median_s": 0.66929, + "warm_min_s": 0.66629, + "warm_max_s": 0.68131, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 0.66629, + "cpu_s": 0.66535, + "load_1min": 2.93 + }, + { + "wall_s": 0.68131, + "cpu_s": 0.68041, + "load_1min": 2.93 + }, + { + "wall_s": 0.67583, + "cpu_s": 0.67438, + "load_1min": 2.93 + }, + { + "wall_s": 0.66708, + "cpu_s": 0.66352, + "load_1min": 2.93 + }, + { + "wall_s": 0.66929, + "cpu_s": 0.66796, + "load_1min": 2.93 + } + ], + "stable": true, + "answer": "e291bf8af6f3ad65" + }, + "S3": { + "first_s": 1.31211, + "first_load_1min": 2.93, + "warm_median_s": 1.32751, + "warm_min_s": 1.31471, + "warm_max_s": 1.38233, + "slowest_over_median": 1.04, + "passes": [ + { + "wall_s": 1.32886, + "cpu_s": 1.3281, + "load_1min": 2.93 + }, + { + "wall_s": 1.32751, + "cpu_s": 1.32325, + "load_1min": 2.86 + }, + { + "wall_s": 1.31808, + "cpu_s": 1.31718, + "load_1min": 2.86 + }, + { + "wall_s": 1.31471, + "cpu_s": 1.31341, + "load_1min": 2.86 + }, + { + "wall_s": 1.38233, + "cpu_s": 1.36173, + "load_1min": 2.86 + } + ], + "stable": true, + "answer": "32ee6933a75f4cc5" + }, + "S4": { + "first_s": 2.80218, + "first_load_1min": 2.79, + "warm_median_s": 2.79216, + "warm_min_s": 2.75448, + "warm_max_s": 2.80559, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 2.79216, + "cpu_s": 2.79064, + "load_1min": 2.79 + }, + { + "wall_s": 2.79498, + "cpu_s": 2.79459, + "load_1min": 2.88 + }, + { + "wall_s": 2.78745, + "cpu_s": 2.78612, + "load_1min": 2.88 + }, + { + "wall_s": 2.80559, + "cpu_s": 2.80439, + "load_1min": 2.97 + }, + { + "wall_s": 2.75448, + "cpu_s": 2.75071, + "load_1min": 2.97 + } + ], + "stable": true, + "answer": "3a8819936f0fa436" + }, + "S5": { + "first_s": 3.38156, + "first_load_1min": 2.82, + "warm_median_s": 3.4169, + "warm_min_s": 3.40434, + "warm_max_s": 3.42016, + "slowest_over_median": 1.0, + "passes": [ + { + "wall_s": 3.4169, + "cpu_s": 3.41591, + "load_1min": 2.75 + }, + { + "wall_s": 3.42016, + "cpu_s": 3.41647, + "load_1min": 2.75 + }, + { + "wall_s": 3.41933, + "cpu_s": 3.40625, + "load_1min": 2.69 + }, + { + "wall_s": 3.40434, + "cpu_s": 3.40285, + "load_1min": 2.87 + }, + { + "wall_s": 3.40661, + "cpu_s": 3.40548, + "load_1min": 2.87 + } + ], + "stable": true, + "answer": "38333b798f280324" + } + } + }, + "paths-scores": { + "queries": 5, + "median_of_warm_medians_s": 0.0059, + "min_s": 0.0019, + "max_s": 0.01245, + "load_1min_range": [ + 2.8, + 2.8 + ], + "per_query": { + "L0": { + "first_s": 0.03515, + "first_load_1min": 2.8, + "warm_median_s": 0.0019, + "warm_min_s": 0.0018, + "warm_max_s": 0.00205, + "slowest_over_median": 1.08, + "passes": [ + { + "wall_s": 0.00205, + "cpu_s": 0.00205, + "load_1min": 2.8 + }, + { + "wall_s": 0.0019, + "cpu_s": 0.0019, + "load_1min": 2.8 + }, + { + "wall_s": 0.0019, + "cpu_s": 0.0019, + "load_1min": 2.8 + }, + { + "wall_s": 0.0018, + "cpu_s": 0.00181, + "load_1min": 2.8 + }, + { + "wall_s": 0.00187, + "cpu_s": 0.00188, + "load_1min": 2.8 + } + ], + "stable": true, + "answer": "4f53cda18c2baa0c" + }, + "L6": { + "first_s": 0.00349, + "first_load_1min": 2.8, + "warm_median_s": 0.00317, + "warm_min_s": 0.00309, + "warm_max_s": 0.00325, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 0.00323, + "cpu_s": 0.00323, + "load_1min": 2.8 + }, + { + "wall_s": 0.00325, + "cpu_s": 0.00325, + "load_1min": 2.8 + }, + { + "wall_s": 0.00315, + "cpu_s": 0.00316, + "load_1min": 2.8 + }, + { + "wall_s": 0.00317, + "cpu_s": 0.00317, + "load_1min": 2.8 + }, + { + "wall_s": 0.00309, + "cpu_s": 0.00309, + "load_1min": 2.8 + } + ], + "stable": true, + "answer": "fbb18d5391251239" + }, + "L11": { + "first_s": 0.00638, + "first_load_1min": 2.8, + "warm_median_s": 0.0059, + "warm_min_s": 0.00575, + "warm_max_s": 0.00613, + "slowest_over_median": 1.04, + "passes": [ + { + "wall_s": 0.00613, + "cpu_s": 0.00614, + "load_1min": 2.8 + }, + { + "wall_s": 0.0059, + "cpu_s": 0.00592, + "load_1min": 2.8 + }, + { + "wall_s": 0.00575, + "cpu_s": 0.00576, + "load_1min": 2.8 + }, + { + "wall_s": 0.00586, + "cpu_s": 0.00592, + "load_1min": 2.8 + }, + { + "wall_s": 0.00602, + "cpu_s": 0.00603, + "load_1min": 2.8 + } + ], + "stable": true, + "answer": "c1852a5e85df4b1d" + }, + "L17": { + "first_s": 0.00869, + "first_load_1min": 2.8, + "warm_median_s": 0.00774, + "warm_min_s": 0.00764, + "warm_max_s": 0.00795, + "slowest_over_median": 1.03, + "passes": [ + { + "wall_s": 0.00789, + "cpu_s": 0.0079, + "load_1min": 2.8 + }, + { + "wall_s": 0.00795, + "cpu_s": 0.00798, + "load_1min": 2.8 + }, + { + "wall_s": 0.00773, + "cpu_s": 0.00774, + "load_1min": 2.8 + }, + { + "wall_s": 0.00764, + "cpu_s": 0.00766, + "load_1min": 2.8 + }, + { + "wall_s": 0.00774, + "cpu_s": 0.00776, + "load_1min": 2.8 + } + ], + "stable": true, + "answer": "fc5ddb623b636ebc" + }, + "L23": { + "first_s": 0.01303, + "first_load_1min": 2.8, + "warm_median_s": 0.01245, + "warm_min_s": 0.01232, + "warm_max_s": 0.01266, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 0.01234, + "cpu_s": 0.01234, + "load_1min": 2.8 + }, + { + "wall_s": 0.01266, + "cpu_s": 0.01269, + "load_1min": 2.8 + }, + { + "wall_s": 0.01232, + "cpu_s": 0.01233, + "load_1min": 2.8 + }, + { + "wall_s": 0.01245, + "cpu_s": 0.01249, + "load_1min": 2.8 + }, + { + "wall_s": 0.01246, + "cpu_s": 0.01248, + "load_1min": 2.8 + } + ], + "stable": true, + "answer": "84ae68b25529f27f" + } + } + }, + "paths-search": { + "queries": 5, + "median_of_warm_medians_s": 0.00468, + "min_s": 0.00184, + "max_s": 0.01148, + "load_1min_range": [ + 2.8, + 2.8 + ], + "per_query": { + "L0": { + "first_s": 0.00208, + "first_load_1min": 2.8, + "warm_median_s": 0.00184, + "warm_min_s": 0.00184, + "warm_max_s": 0.00188, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 0.00188, + "cpu_s": 0.00188, + "load_1min": 2.8 + }, + { + "wall_s": 0.00184, + "cpu_s": 0.00184, + "load_1min": 2.8 + }, + { + "wall_s": 0.00184, + "cpu_s": 0.00184, + "load_1min": 2.8 + }, + { + "wall_s": 0.00185, + "cpu_s": 0.00185, + "load_1min": 2.8 + }, + { + "wall_s": 0.00184, + "cpu_s": 0.00184, + "load_1min": 2.8 + } + ], + "stable": true, + "answer": "4f53cda18c2baa0c" + }, + "L6": { + "first_s": 0.00303, + "first_load_1min": 2.8, + "warm_median_s": 0.0027, + "warm_min_s": 0.00267, + "warm_max_s": 0.00276, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 0.00275, + "cpu_s": 0.00276, + "load_1min": 2.8 + }, + { + "wall_s": 0.00276, + "cpu_s": 0.00276, + "load_1min": 2.8 + }, + { + "wall_s": 0.0027, + "cpu_s": 0.0027, + "load_1min": 2.8 + }, + { + "wall_s": 0.0027, + "cpu_s": 0.0027, + "load_1min": 2.8 + }, + { + "wall_s": 0.00267, + "cpu_s": 0.00267, + "load_1min": 2.8 + } + ], + "stable": true, + "answer": "34c3fc5d495f9373" + }, + "L11": { + "first_s": 0.0052, + "first_load_1min": 2.8, + "warm_median_s": 0.00468, + "warm_min_s": 0.00465, + "warm_max_s": 0.00479, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 0.00468, + "cpu_s": 0.00469, + "load_1min": 2.8 + }, + { + "wall_s": 0.00465, + "cpu_s": 0.00465, + "load_1min": 2.8 + }, + { + "wall_s": 0.00474, + "cpu_s": 0.00475, + "load_1min": 2.8 + }, + { + "wall_s": 0.00479, + "cpu_s": 0.00479, + "load_1min": 2.8 + }, + { + "wall_s": 0.00468, + "cpu_s": 0.00469, + "load_1min": 2.8 + } + ], + "stable": true, + "answer": "a02d8d72fe9fc718" + }, + "L17": { + "first_s": 0.00741, + "first_load_1min": 2.8, + "warm_median_s": 0.00667, + "warm_min_s": 0.00662, + "warm_max_s": 0.00682, + "slowest_over_median": 1.02, + "passes": [ + { + "wall_s": 0.00667, + "cpu_s": 0.00667, + "load_1min": 2.8 + }, + { + "wall_s": 0.00667, + "cpu_s": 0.00669, + "load_1min": 2.8 + }, + { + "wall_s": 0.00669, + "cpu_s": 0.0067, + "load_1min": 2.8 + }, + { + "wall_s": 0.00682, + "cpu_s": 0.00683, + "load_1min": 2.8 + }, + { + "wall_s": 0.00662, + "cpu_s": 0.00662, + "load_1min": 2.8 + } + ], + "stable": true, + "answer": "35449edca71ade6a" + }, + "L23": { + "first_s": 0.01217, + "first_load_1min": 2.8, + "warm_median_s": 0.01148, + "warm_min_s": 0.01137, + "warm_max_s": 0.01159, + "slowest_over_median": 1.01, + "passes": [ + { + "wall_s": 0.01159, + "cpu_s": 0.01159, + "load_1min": 2.8 + }, + { + "wall_s": 0.01148, + "cpu_s": 0.01148, + "load_1min": 2.8 + }, + { + "wall_s": 0.01137, + "cpu_s": 0.01138, + "load_1min": 2.8 + }, + { + "wall_s": 0.01148, + "cpu_s": 0.01148, + "load_1min": 2.8 + }, + { + "wall_s": 0.01144, + "cpu_s": 0.01146, + "load_1min": 2.8 + } + ], + "stable": true, + "answer": "2244045ae40dfaf0" + } + } + } + }, + "fresh": { + "free-class/L0": { + "query_s": [ + 0.00053, + 0.00051, + 0.0005 + ], + "open_s": [ + 0.00064, + 0.00065, + 0.00061 + ], + "peak_rss_mb": [ + 68.2, + 68.3, + 68.1 + ], + "load_1min": [ + 2.8, + 2.8, + 2.8 + ], + "answers": [ + "71417a323b7f309d" + ], + "errors": 0 + }, + "free-class/L11": { + "query_s": [ + 0.96426, + 0.95301, + 0.9486 + ], + "open_s": [ + 0.00055, + 0.00069, + 0.00068 + ], + "peak_rss_mb": [ + 72.5, + 72.4, + 72.7 + ], + "load_1min": [ + 2.8, + 2.74, + 2.74 + ], + "answers": [ + "5562995b852b99bc" + ], + "errors": 0 + }, + "free-class/L23": { + "query_s": [ + 4.02561, + 4.03781, + 4.03935 + ], + "open_s": [ + 0.00064, + 0.00074, + 0.00064 + ], + "peak_rss_mb": [ + 73.0, + 73.4, + 72.9 + ], + "load_1min": [ + 2.74, + 2.76, + 2.78 + ], + "answers": [ + "f9cff73ec1dd0455" + ], + "errors": 0 + }, + "paths-scores/L0": { + "query_s": [ + 0.00297, + 0.00277, + 0.00282 + ], + "open_s": [ + 0.00061, + 0.00059, + 0.0006 + ], + "peak_rss_mb": [ + 70.8, + 70.1, + 70.4 + ], + "load_1min": [ + 2.96, + 2.96, + 2.96 + ], + "answers": [ + "4f53cda18c2baa0c" + ], + "errors": 0 + }, + "paths-scores/L11": { + "query_s": [ + 0.00715, + 0.00695, + 0.00686 + ], + "open_s": [ + 0.00059, + 0.00059, + 0.00061 + ], + "peak_rss_mb": [ + 70.9, + 70.6, + 70.7 + ], + "load_1min": [ + 2.96, + 2.96, + 2.96 + ], + "answers": [ + "c1852a5e85df4b1d" + ], + "errors": 0 + }, + "paths-scores/L23": { + "query_s": [ + 0.01406, + 0.01413, + 0.01433 + ], + "open_s": [ + 0.00063, + 0.00061, + 0.00062 + ], + "peak_rss_mb": [ + 70.5, + 71.0, + 70.5 + ], + "load_1min": [ + 2.96, + 2.96, + 2.96 + ], + "answers": [ + "84ae68b25529f27f" + ], + "errors": 0 + } + } + } + }, + "noise": { + "before": { + "passes": 210, + "max_over_median": 1.27, + "passes_1_2x_or_more": 2, + "slow_passes": [ + { + "shape": "free-class", + "query": "L20", + "wall_s": 33.08531, + "cpu_s": 18.93857, + "over_median": 1.27, + "load_1min": 3.75 + }, + { + "shape": "free-class", + "query": "S4", + "wall_s": 25.983, + "cpu_s": 21.93972, + "over_median": 1.25, + "load_1min": 3.08 + } + ], + "passes_wall_1_1x_cpu_or_more": 10, + "waited_passes": [ + { + "shape": "free-class", + "query": "L20", + "wall_s": 33.08531, + "cpu_s": 18.93857, + "wall_over_cpu": 1.75, + "load_1min": 3.75 + }, + { + "shape": "free-class", + "query": "L20", + "wall_s": 26.52002, + "cpu_s": 18.9552, + "wall_over_cpu": 1.4, + "load_1min": 4.25 + }, + { + "shape": "free-class", + "query": "L20", + "wall_s": 26.08663, + "cpu_s": 19.08248, + "wall_over_cpu": 1.37, + "load_1min": 4.64 + }, + { + "shape": "free-class", + "query": "L20", + "wall_s": 23.26903, + "cpu_s": 18.85745, + "wall_over_cpu": 1.23, + "load_1min": 4.62 + }, + { + "shape": "free-class", + "query": "L23", + "wall_s": 34.09009, + "cpu_s": 26.69955, + "wall_over_cpu": 1.28, + "load_1min": 5.43 + }, + { + "shape": "free-class", + "query": "L23", + "wall_s": 38.55505, + "cpu_s": 27.49581, + "wall_over_cpu": 1.4, + "load_1min": 5.56 + }, + { + "shape": "free-class", + "query": "L23", + "wall_s": 32.27214, + "cpu_s": 27.08689, + "wall_over_cpu": 1.19, + "load_1min": 5.17 + }, + { + "shape": "free-class", + "query": "L23", + "wall_s": 30.00364, + "cpu_s": 26.60909, + "wall_over_cpu": 1.13, + "load_1min": 5.27 + }, + { + "shape": "free-class", + "query": "L23", + "wall_s": 31.93925, + "cpu_s": 26.77795, + "wall_over_cpu": 1.19, + "load_1min": 5.47 + }, + { + "shape": "free-class", + "query": "S4", + "wall_s": 25.983, + "cpu_s": 21.93972, + "wall_over_cpu": 1.18, + "load_1min": 3.08 + } + ] + }, + "after": { + "passes": 130, + "max_over_median": 1.08, + "passes_1_2x_or_more": 0, + "slow_passes": [], + "passes_wall_1_1x_cpu_or_more": 0, + "waited_passes": [] + } + }, + "ledger": { + "before": { + "open_s": 0.00031, + "open_load_1min": 2.19, + "records": 387838, + "singles": { + "producers_of": { + "median_warm_s": 2.429073, + "median_first_s": 2.4134429, + "load_1min_range": [ + 1.93, + 2.69 + ], + "per_digest": { + "0": { + "first_s": 2.4377892, + "warm_median_s": 2.4351054, + "present": true, + "answer": "281f45dcb33affb2", + "load_1min": [ + 1.93, + 2.19 + ] + }, + "1": { + "first_s": 2.4312044, + "warm_median_s": 2.429073, + "present": true, + "answer": "88abfc17e37bdd72", + "load_1min": [ + 1.93, + 2.1 + ] + }, + "2": { + "first_s": 2.4134429, + "warm_median_s": 2.3623437, + "present": true, + "answer": "cd20b882c9cd5aad", + "load_1min": [ + 2.1, + 2.41 + ] + }, + "3": { + "first_s": 2.3538287, + "warm_median_s": 2.4334394, + "present": true, + "answer": "6cce75eb80035638", + "load_1min": [ + 2.29, + 2.43 + ] + }, + "4": { + "first_s": 2.4119221, + "warm_median_s": 2.4161079, + "present": true, + "answer": "5f3aacf70de1131f", + "load_1min": [ + 2.43, + 2.63 + ] + }, + "5": { + "first_s": 2.3803732, + "warm_median_s": 2.3710867, + "present": false, + "answer": "4f53cda18c2baa0c", + "load_1min": [ + 2.45, + 2.58 + ] + }, + "6": { + "first_s": 2.4155808, + "warm_median_s": 2.440302, + "present": false, + "answer": "4f53cda18c2baa0c", + "load_1min": [ + 2.23, + 2.69 + ] + } + } + }, + "already_attested": { + "median_warm_s": 2.401811, + "median_first_s": 2.4173772, + "load_1min_range": [ + 2.55, + 3.61 + ], + "per_digest": { + "0": { + "first_s": 2.4015115, + "warm_median_s": 2.401811, + "present": true, + "answer": "b5bea41b6c623f7c", + "load_1min": [ + 2.55, + 2.62 + ] + }, + "1": { + "first_s": 2.5158138, + "warm_median_s": 2.4230501, + "present": true, + "answer": "b5bea41b6c623f7c", + "load_1min": [ + 2.62, + 2.76 + ] + }, + "2": { + "first_s": 2.4065038, + "warm_median_s": 2.3924573, + "present": true, + "answer": "b5bea41b6c623f7c", + "load_1min": [ + 2.59, + 2.73 + ] + }, + "3": { + "first_s": 2.437204, + "warm_median_s": 2.429901, + "present": true, + "answer": "b5bea41b6c623f7c", + "load_1min": [ + 2.62, + 2.81 + ] + }, + "4": { + "first_s": 2.4173772, + "warm_median_s": 2.3575687, + "present": true, + "answer": "b5bea41b6c623f7c", + "load_1min": [ + 2.69, + 3.53 + ] + }, + "5": { + "first_s": 2.3511548, + "warm_median_s": 2.4269742, + "present": false, + "answer": "fcbcf165908dd18a", + "load_1min": [ + 3.49, + 3.61 + ] + }, + "6": { + "first_s": 2.4293385, + "warm_median_s": 2.3973939, + "present": false, + "answer": "fcbcf165908dd18a", + "load_1min": [ + 3.21, + 3.41 + ] + } + } + }, + "attested_by": { + "median_warm_s": 2.4227729, + "median_first_s": 2.400689, + "load_1min_range": [ + 2.65, + 3.44 + ], + "per_digest": { + "0": { + "first_s": 2.3320339, + "warm_median_s": 2.437678, + "present": true, + "answer": "281f45dcb33affb2", + "load_1min": [ + 3.03, + 3.04 + ] + }, + "1": { + "first_s": 2.400689, + "warm_median_s": 2.401289, + "present": true, + "answer": "88abfc17e37bdd72", + "load_1min": [ + 2.65, + 2.87 + ] + }, + "2": { + "first_s": 2.3317112, + "warm_median_s": 2.4303018, + "present": true, + "answer": "cd20b882c9cd5aad", + "load_1min": [ + 2.68, + 2.88 + ] + }, + "3": { + "first_s": 2.4312591, + "warm_median_s": 2.4227729, + "present": true, + "answer": "6cce75eb80035638", + "load_1min": [ + 2.88, + 3.35 + ] + }, + "4": { + "first_s": 2.3929141, + "warm_median_s": 2.3562259, + "present": true, + "answer": "5f3aacf70de1131f", + "load_1min": [ + 3.24, + 3.44 + ] + }, + "5": { + "first_s": 2.417738, + "warm_median_s": 2.4268313, + "present": false, + "answer": "4f53cda18c2baa0c", + "load_1min": [ + 3.17, + 3.32 + ] + }, + "6": { + "first_s": 2.4026528, + "warm_median_s": 2.3732598, + "present": false, + "answer": "4f53cda18c2baa0c", + "load_1min": [ + 3.17, + 3.32 + ] + } + } + } + }, + "batch": { + "digests": 2050, + "producers_by_output": { + "first_s": 0.29181, + "warm_median_s": 0.29152, + "warm_min_s": 0.28902, + "warm_max_s": 0.29338, + "load_1min_range": [ + 3.11, + 3.11 + ], + "answer": "163d91689d798f2a" + }, + "attested_batch": { + "first_s": 0.29175, + "warm_median_s": 0.2903, + "warm_min_s": 0.28899, + "warm_max_s": 0.30751, + "load_1min_range": [ + 3.11, + 3.18 + ], + "answer": "163d91689d798f2a" + } + } + }, + "after": { + "open_s": 0.00029, + "open_load_1min": 2.88, + "records": 387838, + "singles": { + "producers_of": { + "median_warm_s": 8.2e-06, + "median_first_s": 0.000389, + "load_1min_range": [ + 2.88, + 2.88 + ], + "per_digest": { + "0": { + "first_s": 0.0005473, + "warm_median_s": 8.4e-06, + "present": true, + "answer": "281f45dcb33affb2", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "1": { + "first_s": 0.0004015, + "warm_median_s": 8.5e-06, + "present": true, + "answer": "88abfc17e37bdd72", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "2": { + "first_s": 0.0004356, + "warm_median_s": 8.2e-06, + "present": true, + "answer": "cd20b882c9cd5aad", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "3": { + "first_s": 0.000389, + "warm_median_s": 8.2e-06, + "present": true, + "answer": "6cce75eb80035638", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "4": { + "first_s": 0.0003878, + "warm_median_s": 7.5e-06, + "present": true, + "answer": "5f3aacf70de1131f", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "5": { + "first_s": 0.0002693, + "warm_median_s": 6.7e-06, + "present": false, + "answer": "4f53cda18c2baa0c", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "6": { + "first_s": 0.000349, + "warm_median_s": 6.9e-06, + "present": false, + "answer": "4f53cda18c2baa0c", + "load_1min": [ + 2.88, + 2.88 + ] + } + } + }, + "already_attested": { + "median_warm_s": 8.5e-06, + "median_first_s": 1.1e-05, + "load_1min_range": [ + 2.88, + 2.88 + ], + "per_digest": { + "0": { + "first_s": 3.58e-05, + "warm_median_s": 9.1e-06, + "present": true, + "answer": "b5bea41b6c623f7c", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "1": { + "first_s": 2.95e-05, + "warm_median_s": 1e-05, + "present": true, + "answer": "b5bea41b6c623f7c", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "2": { + "first_s": 1.15e-05, + "warm_median_s": 9.7e-06, + "present": true, + "answer": "b5bea41b6c623f7c", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "3": { + "first_s": 1.1e-05, + "warm_median_s": 8.4e-06, + "present": true, + "answer": "b5bea41b6c623f7c", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "4": { + "first_s": 9.7e-06, + "warm_median_s": 8.5e-06, + "present": true, + "answer": "b5bea41b6c623f7c", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "5": { + "first_s": 9.2e-06, + "warm_median_s": 7.7e-06, + "present": false, + "answer": "fcbcf165908dd18a", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "6": { + "first_s": 8.5e-06, + "warm_median_s": 8.3e-06, + "present": false, + "answer": "fcbcf165908dd18a", + "load_1min": [ + 2.88, + 2.88 + ] + } + } + }, + "attested_by": { + "median_warm_s": 8.1e-06, + "median_first_s": 9e-06, + "load_1min_range": [ + 2.88, + 2.88 + ], + "per_digest": { + "0": { + "first_s": 1.13e-05, + "warm_median_s": 8.5e-06, + "present": true, + "answer": "281f45dcb33affb2", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "1": { + "first_s": 9.3e-06, + "warm_median_s": 8.2e-06, + "present": true, + "answer": "88abfc17e37bdd72", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "2": { + "first_s": 9.1e-06, + "warm_median_s": 8.1e-06, + "present": true, + "answer": "cd20b882c9cd5aad", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "3": { + "first_s": 8.9e-06, + "warm_median_s": 8.2e-06, + "present": true, + "answer": "6cce75eb80035638", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "4": { + "first_s": 9e-06, + "warm_median_s": 8.1e-06, + "present": true, + "answer": "5f3aacf70de1131f", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "5": { + "first_s": 8e-06, + "warm_median_s": 7e-06, + "present": false, + "answer": "4f53cda18c2baa0c", + "load_1min": [ + 2.88, + 2.88 + ] + }, + "6": { + "first_s": 7.8e-06, + "warm_median_s": 7.1e-06, + "present": false, + "answer": "4f53cda18c2baa0c", + "load_1min": [ + 2.88, + 2.88 + ] + } + } + } + }, + "batch": { + "digests": 2050, + "producers_by_output": { + "first_s": 0.29529, + "warm_median_s": 0.00639, + "warm_min_s": 0.00596, + "warm_max_s": 0.00974, + "load_1min_range": [ + 2.88, + 2.88 + ], + "answer": "163d91689d798f2a" + }, + "attested_batch": { + "first_s": 0.00676, + "warm_median_s": 0.00646, + "warm_min_s": 0.00626, + "warm_max_s": 0.00663, + "load_1min_range": [ + 2.88, + 2.88 + ], + "answer": "163d91689d798f2a" + } + } + } + }, + "landing": { + "before": [ + { + "open_s": { + "lexical": 0.0007, + "catalog": 0.0014, + "attestations": 0.0003, + "versions": 0.0002 + }, + "load_start_1min": 3.18, + "peak_rss_mb": 379.3, + "statistics": null, + "batches": [ + { + "batch": 0, + "kind": "new", + "items": 2000, + "bytes": 5528205, + "land_s": 17.133, + "items_per_s": 116.7, + "load_1min": 3.08, + "load_end_1min": 2.85, + "statuses": { + "landed": 2000 + }, + "upkeep": null, + "land_many": { + "calls": 1, + "seconds": 15.0937 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.0548 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.6909 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 7386, + "units_current_delta": 7386, + "stages_s": { + "admit": 0.272, + "derive": 0.471, + "index": 15.094, + "finish": 1.287 + } + }, + { + "batch": 1, + "kind": "new", + "items": 2000, + "bytes": 4330924, + "land_s": 10.267, + "items_per_s": 194.8, + "load_1min": 2.85, + "load_end_1min": 2.72, + "statuses": { + "landed": 2000 + }, + "upkeep": null, + "land_many": { + "calls": 1, + "seconds": 8.6633 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.0541 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.4182 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 5938, + "units_current_delta": 5938, + "stages_s": { + "admit": 0.271, + "derive": 0.435, + "index": 8.664, + "finish": 0.89 + } + }, + { + "batch": 2, + "kind": "new", + "items": 2000, + "bytes": 5629222, + "land_s": 11.131, + "items_per_s": 179.7, + "load_1min": 2.58, + "load_end_1min": 2.63, + "statuses": { + "landed": 2000 + }, + "upkeep": null, + "land_many": { + "calls": 1, + "seconds": 9.5577 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.0519 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.4105 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 7360, + "units_current_delta": 7360, + "stages_s": { + "admit": 0.275, + "derive": 0.47, + "index": 9.558, + "finish": 0.82 + } + }, + { + "batch": 3, + "kind": "replace", + "items": 2000, + "bytes": 5651222, + "land_s": 10.187, + "items_per_s": 196.3, + "load_1min": 2.63, + "load_end_1min": 2.38, + "statuses": { + "landed": 2000 + }, + "upkeep": null, + "land_many": { + "calls": 1, + "seconds": 8.6584 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.0592 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.3843 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 7371, + "units_current_delta": 11, + "stages_s": { + "admit": 0.281, + "derive": 0.473, + "index": 8.659, + "finish": 0.759 + } + } + ] + }, + { + "open_s": { + "lexical": 0.0014, + "catalog": 0.0015, + "attestations": 0.0003, + "versions": 0.0003 + }, + "load_start_1min": 2.38, + "peak_rss_mb": 379.6, + "statistics": null, + "batches": [ + { + "batch": 0, + "kind": "new", + "items": 2000, + "bytes": 5797548, + "land_s": 17.297, + "items_per_s": 115.6, + "load_1min": 2.43, + "load_end_1min": 2.27, + "statuses": { + "landed": 2000 + }, + "upkeep": null, + "land_many": { + "calls": 1, + "seconds": 15.1643 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.0557 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.7533 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 7626, + "units_current_delta": 7626, + "stages_s": { + "admit": 0.273, + "derive": 0.47, + "index": 15.165, + "finish": 1.379 + } + }, + { + "batch": 1, + "kind": "new", + "items": 2000, + "bytes": 5377381, + "land_s": 11.501, + "items_per_s": 173.9, + "load_1min": 2.27, + "load_end_1min": 2.3, + "statuses": { + "landed": 2000 + }, + "upkeep": null, + "land_many": { + "calls": 1, + "seconds": 10.0085 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.05 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.3225 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 7255, + "units_current_delta": 7255, + "stages_s": { + "admit": 0.271, + "derive": 0.448, + "index": 10.009, + "finish": 0.765 + } + }, + { + "batch": 2, + "kind": "new", + "items": 2000, + "bytes": 4855730, + "land_s": 10.118, + "items_per_s": 197.7, + "load_1min": 2.3, + "load_end_1min": 2.79, + "statuses": { + "landed": 2000 + }, + "upkeep": null, + "land_many": { + "calls": 1, + "seconds": 8.7014 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.0525 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.3142 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 6570, + "units_current_delta": 6570, + "stages_s": { + "admit": 0.273, + "derive": 0.443, + "index": 8.702, + "finish": 0.693 + } + }, + { + "batch": 3, + "kind": "replace", + "items": 2000, + "bytes": 4877730, + "land_s": 8.945, + "items_per_s": 223.6, + "load_1min": 2.79, + "load_end_1min": 2.67, + "statuses": { + "landed": 2000 + }, + "upkeep": null, + "land_many": { + "calls": 1, + "seconds": 7.4392 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.0554 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.396 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 6584, + "units_current_delta": 14, + "stages_s": { + "admit": 0.286, + "derive": 0.448, + "index": 7.44, + "finish": 0.756 + } + } + ] + }, + { + "open_s": { + "lexical": 0.0008, + "catalog": 0.0013, + "attestations": 0.0003, + "versions": 0.0003 + }, + "load_start_1min": 2.67, + "peak_rss_mb": 373.6, + "statistics": null, + "batches": [ + { + "batch": 0, + "kind": "new", + "items": 2000, + "bytes": 4708283, + "land_s": 15.742, + "items_per_s": 127.1, + "load_1min": 2.67, + "load_end_1min": 2.55, + "statuses": { + "landed": 2000 + }, + "upkeep": null, + "land_many": { + "calls": 1, + "seconds": 13.7657 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.0488 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.682 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 6443, + "units_current_delta": 6443, + "stages_s": { + "admit": 0.271, + "derive": 0.443, + "index": 13.766, + "finish": 1.252 + } + }, + { + "batch": 1, + "kind": "new", + "items": 2000, + "bytes": 3931022, + "land_s": 9.414, + "items_per_s": 212.4, + "load_1min": 2.55, + "load_end_1min": 2.31, + "statuses": { + "landed": 2000 + }, + "upkeep": null, + "land_many": { + "calls": 1, + "seconds": 7.9788 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.0502 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.2994 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 5438, + "units_current_delta": 5438, + "stages_s": { + "admit": 0.271, + "derive": 0.413, + "index": 7.979, + "finish": 0.744 + } + }, + { + "batch": 2, + "kind": "new", + "items": 2000, + "bytes": 5077113, + "land_s": 10.625, + "items_per_s": 188.2, + "load_1min": 2.31, + "load_end_1min": 2.11, + "statuses": { + "landed": 2000 + }, + "upkeep": null, + "land_many": { + "calls": 1, + "seconds": 9.2299 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.0499 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.3027 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 6826, + "units_current_delta": 6826, + "stages_s": { + "admit": 0.271, + "derive": 0.442, + "index": 9.23, + "finish": 0.674 + } + }, + { + "batch": 3, + "kind": "replace", + "items": 2000, + "bytes": 5099113, + "land_s": 9.882, + "items_per_s": 202.4, + "load_1min": 2.11, + "load_end_1min": 2.49, + "statuses": { + "landed": 2000 + }, + "upkeep": null, + "land_many": { + "calls": 1, + "seconds": 8.2928 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.0556 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.416 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 6839, + "units_current_delta": 13, + "stages_s": { + "admit": 0.283, + "derive": 0.444, + "index": 8.293, + "finish": 0.846 + } + } + ] + } + ], + "after": [ + { + "open_s": { + "lexical": 0.001, + "catalog": 0.0013, + "attestations": 0.0004, + "versions": 0.0003 + }, + "load_start_1min": 2.88, + "peak_rss_mb": 365.5, + "statistics": { + "kept": [ + 1390639, + 193373181 + ], + "counted": [ + 1390639, + 193373181 + ], + "equal": true + }, + "batches": [ + { + "batch": 0, + "kind": "new", + "items": 2000, + "bytes": 5528205, + "land_s": 19.021, + "items_per_s": 105.1, + "load_1min": 2.81, + "load_end_1min": 2.79, + "statuses": { + "landed": 2000 + }, + "upkeep": { + "calls": 1, + "units": 7386, + "seconds": 0.4367 + }, + "land_many": { + "calls": 1, + "seconds": 17.2733 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.1663 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.2143 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 7386, + "units_current_delta": 7386, + "stages_s": { + "admit": 0.244, + "derive": 0.485, + "index": 17.274, + "finish": 1.008 + } + }, + { + "batch": 1, + "kind": "new", + "items": 2000, + "bytes": 4330924, + "land_s": 11.178, + "items_per_s": 178.9, + "load_1min": 2.73, + "load_end_1min": 2.93, + "statuses": { + "landed": 2000 + }, + "upkeep": { + "calls": 1, + "units": 5938, + "seconds": 0.3467 + }, + "land_many": { + "calls": 1, + "seconds": 9.7644 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.1408 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.0875 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 5938, + "units_current_delta": 5938, + "stages_s": { + "admit": 0.24, + "derive": 0.443, + "index": 9.765, + "finish": 0.722 + } + }, + { + "batch": 2, + "kind": "new", + "items": 2000, + "bytes": 5629222, + "land_s": 12.153, + "items_per_s": 164.6, + "load_1min": 2.93, + "load_end_1min": 3.25, + "statuses": { + "landed": 2000 + }, + "upkeep": { + "calls": 1, + "units": 7360, + "seconds": 0.4156 + }, + "land_many": { + "calls": 1, + "seconds": 10.8597 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.1262 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.0455 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 7360, + "units_current_delta": 7360, + "stages_s": { + "admit": 0.242, + "derive": 0.475, + "index": 10.86, + "finish": 0.568 + } + }, + { + "batch": 3, + "kind": "replace", + "items": 2000, + "bytes": 5651222, + "land_s": 11.613, + "items_per_s": 172.2, + "load_1min": 3.25, + "load_end_1min": 3.18, + "statuses": { + "landed": 2000 + }, + "upkeep": { + "calls": 1, + "units": 14731, + "seconds": 0.8526 + }, + "land_many": { + "calls": 1, + "seconds": 10.2952 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.1164 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.0258 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 7371, + "units_current_delta": 11, + "stages_s": { + "admit": 0.284, + "derive": 0.484, + "index": 10.296, + "finish": 0.525 + } + } + ] + }, + { + "open_s": { + "lexical": 0.0018, + "catalog": 0.0013, + "attestations": 0.0004, + "versions": 0.0003 + }, + "load_start_1min": 3.41, + "peak_rss_mb": 366.3, + "statistics": { + "kept": [ + 1391409, + 193433891 + ], + "counted": [ + 1391409, + 193433891 + ], + "equal": true + }, + "batches": [ + { + "batch": 0, + "kind": "new", + "items": 2000, + "bytes": 5797548, + "land_s": 18.256, + "items_per_s": 109.6, + "load_1min": 3.86, + "load_end_1min": 3.46, + "statuses": { + "landed": 2000 + }, + "upkeep": { + "calls": 1, + "units": 7626, + "seconds": 0.4394 + }, + "land_many": { + "calls": 1, + "seconds": 16.487 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.1674 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.2326 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 7626, + "units_current_delta": 7626, + "stages_s": { + "admit": 0.251, + "derive": 0.491, + "index": 16.488, + "finish": 1.017 + } + }, + { + "batch": 1, + "kind": "new", + "items": 2000, + "bytes": 5377381, + "land_s": 10.548, + "items_per_s": 189.6, + "load_1min": 3.42, + "load_end_1min": 3.74, + "statuses": { + "landed": 2000 + }, + "upkeep": { + "calls": 1, + "units": 7255, + "seconds": 0.3939 + }, + "land_many": { + "calls": 1, + "seconds": 9.1576 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.1345 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.078 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 7255, + "units_current_delta": 7255, + "stages_s": { + "admit": 0.241, + "derive": 0.467, + "index": 9.158, + "finish": 0.674 + } + }, + { + "batch": 2, + "kind": "new", + "items": 2000, + "bytes": 4855730, + "land_s": 11.088, + "items_per_s": 180.4, + "load_1min": 3.74, + "load_end_1min": 3.62, + "statuses": { + "landed": 2000 + }, + "upkeep": { + "calls": 1, + "units": 6570, + "seconds": 0.5295 + }, + "land_many": { + "calls": 1, + "seconds": 9.788 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.1239 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.0428 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 6570, + "units_current_delta": 6570, + "stages_s": { + "admit": 0.246, + "derive": 0.473, + "index": 9.788, + "finish": 0.572 + } + }, + { + "batch": 3, + "kind": "replace", + "items": 2000, + "bytes": 4877730, + "land_s": 10.812, + "items_per_s": 185.0, + "load_1min": 3.62, + "load_end_1min": 3.59, + "statuses": { + "landed": 2000 + }, + "upkeep": { + "calls": 1, + "units": 13154, + "seconds": 0.7434 + }, + "land_many": { + "calls": 1, + "seconds": 9.5116 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.1145 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.0283 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 6584, + "units_current_delta": 14, + "stages_s": { + "admit": 0.278, + "derive": 0.459, + "index": 9.512, + "finish": 0.538 + } + } + ] + }, + { + "open_s": { + "lexical": 0.0021, + "catalog": 0.0012, + "attestations": 0.0003, + "versions": 0.0003 + }, + "load_start_1min": 3.66, + "peak_rss_mb": 365.7, + "statistics": { + "kept": [ + 1388664, + 192997700 + ], + "counted": [ + 1388664, + 192997700 + ], + "equal": true + }, + "batches": [ + { + "batch": 0, + "kind": "new", + "items": 2000, + "bytes": 4708283, + "land_s": 16.869, + "items_per_s": 118.6, + "load_1min": 3.66, + "load_end_1min": 3.8, + "statuses": { + "landed": 2000 + }, + "upkeep": { + "calls": 1, + "units": 6443, + "seconds": 0.3836 + }, + "land_many": { + "calls": 1, + "seconds": 15.029 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.1949 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.2333 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 6443, + "units_current_delta": 6443, + "stages_s": { + "admit": 0.244, + "derive": 0.472, + "index": 15.03, + "finish": 1.114 + } + }, + { + "batch": 1, + "kind": "new", + "items": 2000, + "bytes": 3931022, + "land_s": 9.747, + "items_per_s": 205.2, + "load_1min": 3.82, + "load_end_1min": 3.77, + "statuses": { + "landed": 2000 + }, + "upkeep": { + "calls": 1, + "units": 5438, + "seconds": 0.3017 + }, + "land_many": { + "calls": 1, + "seconds": 8.3581 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.1362 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.0729 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 5438, + "units_current_delta": 5438, + "stages_s": { + "admit": 0.259, + "derive": 0.456, + "index": 8.359, + "finish": 0.665 + } + }, + { + "batch": 2, + "kind": "new", + "items": 2000, + "bytes": 5077113, + "land_s": 11.762, + "items_per_s": 170.0, + "load_1min": 3.77, + "load_end_1min": 3.82, + "statuses": { + "landed": 2000 + }, + "upkeep": { + "calls": 1, + "units": 6826, + "seconds": 0.3838 + }, + "land_many": { + "calls": 1, + "seconds": 10.4552 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.123 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.0406 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 6826, + "units_current_delta": 6826, + "stages_s": { + "admit": 0.251, + "derive": 0.48, + "index": 10.456, + "finish": 0.567 + } + }, + { + "batch": 3, + "kind": "replace", + "items": 2000, + "bytes": 5099113, + "land_s": 10.925, + "items_per_s": 183.1, + "load_1min": 3.82, + "load_end_1min": 4.0, + "statuses": { + "landed": 2000 + }, + "upkeep": { + "calls": 1, + "units": 13665, + "seconds": 0.7642 + }, + "land_many": { + "calls": 1, + "seconds": 9.6315 + }, + "land": null, + "appends": { + "calls": 2000, + "seconds": 0.112 + }, + "producers_by_output": { + "calls": 1, + "seconds": 0.0238 + }, + "producers_of": null, + "ledger_grew": 2000, + "units_landed": 6839, + "units_current_delta": 13, + "stages_s": { + "admit": 0.272, + "derive": 0.464, + "index": 9.632, + "finish": 0.533 + } + } + ] + } + ] + }, + "single": { + "before": [ + { + "open_s": { + "lexical": 0.0014, + "catalog": 0.0014, + "attestations": 0.0003, + "versions": 0.0003 + }, + "load_start_1min": 2.49, + "peak_rss_mb": 853.7, + "statistics": null, + "batches": [ + { + "batch": 0, + "kind": "new", + "items": 3, + "bytes": 8134, + "land_s": 22.82, + "items_per_s": 0.1, + "load_1min": 2.29, + "load_end_1min": 2.22, + "statuses": { + "landed": 3 + }, + "upkeep": null, + "land_many": null, + "land": { + "calls": 3, + "seconds": 0.1311 + }, + "appends": { + "calls": 3, + "seconds": 0.0043 + }, + "producers_by_output": null, + "producers_of": { + "calls": 9, + "seconds": 22.6776 + }, + "ledger_grew": 3, + "units_landed": 9, + "units_current_delta": 9, + "stages_s": {} + } + ] + } + ], + "after": [ + { + "open_s": { + "lexical": 0.0012, + "catalog": 0.0012, + "attestations": 0.0004, + "versions": 0.0003 + }, + "load_start_1min": 3.92, + "peak_rss_mb": 327.9, + "statistics": { + "kept": [ + 1369953, + 190448091 + ], + "counted": [ + 1369953, + 190448091 + ], + "equal": true + }, + "batches": [ + { + "batch": 0, + "kind": "new", + "items": 3, + "bytes": 8134, + "land_s": 0.478, + "items_per_s": 6.3, + "load_1min": 3.92, + "load_end_1min": 3.92, + "statuses": { + "landed": 3 + }, + "upkeep": { + "calls": 3, + "units": 9, + "seconds": 0.0585 + }, + "land_many": null, + "land": { + "calls": 3, + "seconds": 0.4616 + }, + "appends": { + "calls": 3, + "seconds": 0.008 + }, + "producers_by_output": { + "calls": 6, + "seconds": 0.0021 + }, + "producers_of": { + "calls": 3, + "seconds": 0.0001 + }, + "ledger_grew": 3, + "units_landed": 9, + "units_current_delta": 9, + "stages_s": {} + } + ] + } + ] + }, + "pending": { + "before": { + "first_s": 7.543, + "warm_median_s": 2.186, + "warm_min_s": 2.167, + "warm_max_s": 2.207, + "pending": 0, + "load_1min_range": [ + 2.1, + 2.25 + ] + }, + "after": { + "first_s": 7.467, + "warm_median_s": 2.222, + "warm_min_s": 2.149, + "warm_max_s": 2.308, + "pending": 0, + "load_1min_range": [ + 3.56, + 3.79 + ] + } + }, + "concurrent": { + "before": { + "query": "L0", + "delay_s": 5.0, + "load_1min": 2.25, + "first_open": { + "open_s": 0.00113, + "load": 2.25, + "load_end": 2.25, + "migrated": false, + "peak_rss_mb": 68.3 + }, + "second": { + "open_s": 0.00066, + "query_s": 16.65448, + "load": 2.47, + "load_end": 2.21, + "counted_at_query": false, + "answer": "71417a323b7f309d", + "peak_rss_mb": 70.5 + }, + "second_answer_is_the_keyword_parts": true + }, + "after": { + "query": "L0", + "delay_s": 5.0, + "load_1min": 3.79, + "first_open": { + "open_s": 119.33788, + "load": 3.79, + "load_end": 3.38, + "migrated": true, + "peak_rss_mb": 70.5 + }, + "second": { + "open_s": 0.00047, + "query_s": 1.36985, + "load": 3.72, + "load_end": 3.74, + "counted_at_query": false, + "answer": "71417a323b7f309d", + "peak_rss_mb": 70.5 + }, + "second_answer_is_the_keyword_parts": true + } + }, + "not_run": { + "stratum": "not run: a sentence admitting the dialogue stratum loads every row of it with its vector (`all_rows(DIALOGUE_READ)`, core/sentence/universe.py) and builds dense n by n matrices over the items; the corpus instance's stage-1 record (docs/experiments/corpus-stage1-2026-11-07.md) has 4.3 to 4.7 GB at 10,000 items, and the whole corpus would need tens of GB. It belongs to a bounded universe, not to this battery", + "cut": "not run: the test that a commit's cut holds a citation edge reads every edge of the commit (`ReferenceEdgeStore.for_commit`, from core/sentence/universe.py); it needs a citation store, and an instance without one, as the corpus instance is, has no edge for it to read", + "mask": "not run: the pending mask of a sentence's nodes (core/sentence/universe.py) builds the set of pending items again for each node; it is empty when nothing is pending, as on the corpus instance, where `derive.pending` finds 0 items" + }, + "aggregate_ab": { + "rounds": 5, + "rewrites": 70, + "queries": { + "L3": { + "median_case_s": 0.0248, + "median_filter_s": 0.0227, + "filter_faster_pct": 8.6, + "identical": true, + "load_1min_range": [ + 3.05, + 4.21 + ] + }, + "L6": { + "median_case_s": 0.1853, + "median_filter_s": 0.1698, + "filter_faster_pct": 8.4, + "identical": true, + "load_1min_range": [ + 3.05, + 4.21 + ] + }, + "L8": { + "median_case_s": 0.8463, + "median_filter_s": 0.6105, + "filter_faster_pct": 27.9, + "identical": true, + "load_1min_range": [ + 3.05, + 4.21 + ] + }, + "L11": { + "median_case_s": 1.3563, + "median_filter_s": 1.0178, + "filter_faster_pct": 25.0, + "identical": true, + "load_1min_range": [ + 3.13, + 4.03 + ] + }, + "L14": { + "median_case_s": 2.4873, + "median_filter_s": 1.7988, + "filter_faster_pct": 27.7, + "identical": true, + "load_1min_range": [ + 3.04, + 4.03 + ] + }, + "L17": { + "median_case_s": 2.5358, + "median_filter_s": 2.0614, + "filter_faster_pct": 18.7, + "identical": true, + "load_1min_range": [ + 3.04, + 4.03 + ] + }, + "L20": { + "median_case_s": 3.4883, + "median_filter_s": 2.8936, + "filter_faster_pct": 17.0, + "identical": true, + "load_1min_range": [ + 3.18, + 3.86 + ] + }, + "L23": { + "median_case_s": 5.238, + "median_filter_s": 4.1607, + "filter_faster_pct": 20.6, + "identical": true, + "load_1min_range": [ + 3.16, + 3.71 + ] + }, + "L25": { + "median_case_s": 7.5098, + "median_filter_s": 5.8889, + "filter_faster_pct": 21.6, + "identical": true, + "load_1min_range": [ + 3.13, + 3.79 + ] + }, + "S1": { + "median_case_s": 0.9846, + "median_filter_s": 0.8241, + "filter_faster_pct": 16.3, + "identical": true, + "load_1min_range": [ + 3.04, + 3.66 + ] + }, + "S2": { + "median_case_s": 0.8778, + "median_filter_s": 0.6939, + "filter_faster_pct": 20.9, + "identical": true, + "load_1min_range": [ + 3.04, + 3.66 + ] + }, + "S3": { + "median_case_s": 1.8495, + "median_filter_s": 1.3503, + "filter_faster_pct": 27.0, + "identical": true, + "load_1min_range": [ + 2.96, + 3.69 + ] + }, + "S4": { + "median_case_s": 3.682, + "median_filter_s": 2.8516, + "filter_faster_pct": 22.6, + "identical": true, + "load_1min_range": [ + 2.81, + 4.25 + ] + }, + "S5": { + "median_case_s": 4.7289, + "median_filter_s": 3.4646, + "filter_faster_pct": 26.7, + "identical": true, + "load_1min_range": [ + 2.66, + 4.31 + ] + } + }, + "load_start_1min": 2.83, + "load_end_1min": 2.61 + }, + "earlier_runs": { + "before": { + "code": { + "git": "", + "label": "main-f969904e" + }, + "started": "2026-11-12T00:11:25+00:00", + "finished": "2026-11-12T00:51:55+00:00", + "load_start": [ + 3.76, + 3.65, + 2.88 + ], + "load_end": [ + 2.57, + 2.59, + 2.76 + ], + "peak_rss_mb": 815.4 + }, + "after": { + "code": { + "git": "2bedbcf1ee8e3cb214c06815287a808876feae29", + "label": "branch-2bedbcf1" + }, + "started": "2026-11-12T00:52:17+00:00", + "finished": "2026-11-12T01:11:56+00:00", + "load_start": [ + 2.87, + 2.66, + 2.78 + ], + "load_end": [ + 3.65, + 3.46, + 3.34 + ], + "peak_rss_mb": 546.1, + "later_run": { + "started": "2026-11-12T01:18:07+00:00", + "finished": "2026-11-12T01:24:07+00:00", + "load_start": [ + 2.38, + 2.79, + 3.05 + ], + "load_end": [ + 2.65, + 3.69, + 3.48 + ], + "code": { + "git": "f1a1f49cf3b665cd28c276cc7d3f455462bc1577", + "label": "branch-f1a1f49c", + "same_tree_as": "b37d02e9: the same tree, the commit made again when the subject of an earlier commit was reworded" + } + }, + "parts_from_later_run": [ + "keyword", + "ledger", + "stratum" + ] + }, + "answers": { + "compared": 65, + "identical": 65, + "differ": [] + }, + "keyword": { + "before": { + "open_s": 0.002, + "open_load": [ + 3.76, + 3.65, + 2.88 + ], + "units_current": 1369944, + "paths": 400, + "tokenizer": "runs/raw/lower/nomarks/unicode-17.0.0", + "class": "observed", + "queries": { + "L0": { + "terms": 1, + "postings": 108 + }, + "L3": { + "terms": 2, + "postings": 26949 + }, + "L6": { + "terms": 2, + "postings": 191032 + }, + "L8": { + "terms": 10, + "postings": 498437 + }, + "L11": { + "terms": 5, + "postings": 1337195 + }, + "L14": { + "terms": 10, + "postings": 1860446 + }, + "L17": { + "terms": 7, + "postings": 2671741 + }, + "L20": { + "terms": 9, + "postings": 3801316 + }, + "L23": { + "terms": 14, + "postings": 4966503 + }, + "L25": { + "terms": 19, + "postings": 6503751 + }, + "S0": { + "terms": 1, + "postings": 32 + }, + "S1": { + "terms": 3, + "postings": 1224831 + }, + "S2": { + "terms": 4, + "postings": 890406 + }, + "S3": { + "terms": 9, + "postings": 1378417 + }, + "S4": { + "terms": 12, + "postings": 3283060 + }, + "S5": { + "terms": 17, + "postings": 3338954 + } + }, + "shapes": { + "free-class": { + "queries": 16, + "median_of_warm_medians_s": 14.1956, + "min_s": 1.4742, + "max_s": 33.3903, + "load_1min_range": [ + 2.84, + 7.4 + ], + "per_query": { + "L0": { + "first_s": 15.6634, + "warm_median_s": 1.6952, + "warm_min_s": 1.5382, + "warm_max_s": 4.3686, + "load": [ + 3.57, + 3.61, + 2.88 + ], + "load_last": [ + 3.75, + 3.64, + 2.9 + ], + "stable": true, + "answer": "71417a323b7f309d" + }, + "L3": { + "first_s": 5.549, + "warm_median_s": 5.6884, + "warm_min_s": 5.5826, + "warm_max_s": 5.8634, + "load": [ + 3.75, + 3.64, + 2.9 + ], + "load_last": [ + 3.32, + 3.54, + 2.89 + ], + "stable": true, + "answer": "3671f6681d39908b" + }, + "L6": { + "first_s": 5.9676, + "warm_median_s": 5.9492, + "warm_min_s": 3.2901, + "warm_max_s": 6.0001, + "load": [ + 3.13, + 3.5, + 2.88 + ], + "load_last": [ + 3.04, + 3.46, + 2.87 + ], + "stable": true, + "answer": "73b64c8a00b3b2ce" + }, + "L8": { + "first_s": 22.8486, + "warm_median_s": 18.5192, + "warm_min_s": 14.9786, + "warm_max_s": 25.5864, + "load": [ + 2.96, + 3.44, + 2.87 + ], + "load_last": [ + 3.99, + 3.59, + 2.96 + ], + "stable": true, + "answer": "6df6bf83f8dbf6e6" + }, + "L11": { + "first_s": 9.2568, + "warm_median_s": 9.2998, + "warm_min_s": 9.2109, + "warm_max_s": 9.431, + "load": [ + 3.92, + 3.59, + 2.97 + ], + "load_last": [ + 4.12, + 3.66, + 3.02 + ], + "stable": true, + "answer": "5562995b852b99bc" + }, + "L14": { + "first_s": 17.0353, + "warm_median_s": 17.0057, + "warm_min_s": 16.9502, + "warm_max_s": 17.1793, + "load": [ + 4.25, + 3.71, + 3.04 + ], + "load_last": [ + 4.1, + 3.75, + 3.09 + ], + "stable": true, + "answer": "4832dbce59a93911" + }, + "L17": { + "first_s": 13.7547, + "warm_median_s": 13.7868, + "warm_min_s": 13.7119, + "warm_max_s": 16.3785, + "load": [ + 4.46, + 3.84, + 3.14 + ], + "load_last": [ + 4.48, + 3.94, + 3.21 + ], + "stable": true, + "answer": "f2ec600743c6563d" + }, + "L20": { + "first_s": 20.5242, + "warm_median_s": 17.8402, + "warm_min_s": 17.3138, + "warm_max_s": 28.7131, + "load": [ + 6.68, + 4.49, + 3.42 + ], + "load_last": [ + 5.45, + 4.67, + 3.57 + ], + "stable": true, + "answer": "f9c82dc7a44877fd" + }, + "L23": { + "first_s": 25.1426, + "warm_median_s": 25.0065, + "warm_min_s": 24.962, + "warm_max_s": 25.0925, + "load": [ + 4.63, + 4.53, + 3.55 + ], + "load_last": [ + 3.39, + 4.12, + 3.47 + ], + "stable": true, + "answer": "f9cff73ec1dd0455" + }, + "L25": { + "first_s": 33.4424, + "warm_median_s": 33.3903, + "warm_min_s": 33.305, + "warm_max_s": 33.4974, + "load": [ + 3.87, + 4.16, + 3.5 + ], + "load_last": [ + 4.14, + 4.18, + 3.58 + ], + "stable": true, + "answer": "70646b6616899176" + }, + "S0": { + "first_s": 1.463, + "warm_median_s": 1.4742, + "warm_min_s": 1.4543, + "warm_max_s": 1.4826, + "load": [ + 3.76, + 4.08, + 3.57 + ], + "load_last": [ + 3.62, + 4.05, + 3.56 + ], + "stable": true, + "answer": "0d2cb0656ce580c7" + }, + "S1": { + "first_s": 6.2173, + "warm_median_s": 6.2497, + "warm_min_s": 6.235, + "warm_max_s": 6.2911, + "load": [ + 3.62, + 4.05, + 3.56 + ], + "load_last": [ + 3.29, + 3.95, + 3.53 + ], + "stable": true, + "answer": "ebdf28564c404722" + }, + "S2": { + "first_s": 6.9863, + "warm_median_s": 7.0462, + "warm_min_s": 7.0186, + "warm_max_s": 7.05, + "load": [ + 3.5, + 3.98, + 3.55 + ], + "load_last": [ + 3.2, + 3.87, + 3.52 + ], + "stable": true, + "answer": "e291bf8af6f3ad65" + }, + "S3": { + "first_s": 14.7428, + "warm_median_s": 14.6044, + "warm_min_s": 14.5946, + "warm_max_s": 14.7618, + "load": [ + 3.26, + 3.87, + 3.52 + ], + "load_last": [ + 3.22, + 3.78, + 3.5 + ], + "stable": true, + "answer": "32ee6933a75f4cc5" + }, + "S4": { + "first_s": 21.1131, + "warm_median_s": 21.022, + "warm_min_s": 21.0173, + "warm_max_s": 21.1331, + "load": [ + 3.41, + 3.79, + 3.51 + ], + "load_last": [ + 2.84, + 3.55, + 3.44 + ], + "stable": true, + "answer": "3a8819936f0fa436" + }, + "S5": { + "first_s": 28.0759, + "warm_median_s": 27.4366, + "warm_min_s": 27.4171, + "warm_max_s": 27.4885, + "load": [ + 2.85, + 3.49, + 3.42 + ], + "load_last": [ + 3.0, + 3.43, + 3.4 + ], + "stable": true, + "answer": "38333b798f280324" + } + } + }, + "free-all": { + "queries": 16, + "median_of_warm_medians_s": 9.4203, + "min_s": 0.9762, + "max_s": 23.1685, + "load_1min_range": [ + 1.95, + 3.23 + ], + "per_query": { + "L0": { + "first_s": 0.9668, + "warm_median_s": 0.9762, + "warm_min_s": 0.9614, + "warm_max_s": 0.9806, + "load": [ + 2.54, + 3.28, + 3.35 + ], + "load_last": [ + 2.54, + 3.28, + 3.35 + ], + "stable": true, + "answer": "71417a323b7f309d" + }, + "L3": { + "first_s": 1.814, + "warm_median_s": 1.8057, + "warm_min_s": 1.7935, + "warm_max_s": 1.8366, + "load": [ + 2.54, + 3.28, + 3.35 + ], + "load_last": [ + 3.15, + 3.38, + 3.38 + ], + "stable": true, + "answer": "3671f6681d39908b" + }, + "L6": { + "first_s": 2.1134, + "warm_median_s": 2.0967, + "warm_min_s": 2.0951, + "warm_max_s": 2.13, + "load": [ + 3.15, + 3.38, + 3.38 + ], + "load_last": [ + 2.98, + 3.34, + 3.37 + ], + "stable": true, + "answer": "73b64c8a00b3b2ce" + }, + "L8": { + "first_s": 9.2908, + "warm_median_s": 9.3112, + "warm_min_s": 9.2986, + "warm_max_s": 9.3255, + "load": [ + 2.82, + 3.31, + 3.36 + ], + "load_last": [ + 3.23, + 3.36, + 3.37 + ], + "stable": true, + "answer": "6df6bf83f8dbf6e6" + }, + "L11": { + "first_s": 6.2517, + "warm_median_s": 6.2645, + "warm_min_s": 6.2616, + "warm_max_s": 6.2921, + "load": [ + 2.96, + 3.3, + 3.35 + ], + "load_last": [ + 2.48, + 3.17, + 3.3 + ], + "stable": true, + "answer": "5562995b852b99bc" + }, + "L14": { + "first_s": 11.1852, + "warm_median_s": 11.1466, + "warm_min_s": 11.1404, + "warm_max_s": 11.1799, + "load": [ + 2.52, + 3.16, + 3.3 + ], + "load_last": [ + 2.58, + 3.08, + 3.26 + ], + "stable": true, + "answer": "4832dbce59a93911" + }, + "L17": { + "first_s": 9.4716, + "warm_median_s": 9.5295, + "warm_min_s": 9.4907, + "warm_max_s": 9.8403, + "load": [ + 2.57, + 3.07, + 3.25 + ], + "load_last": [ + 2.79, + 3.07, + 3.25 + ], + "stable": true, + "answer": "f2ec600743c6563d" + }, + "L20": { + "first_s": 12.0335, + "warm_median_s": 12.0343, + "warm_min_s": 12.0286, + "warm_max_s": 12.0564, + "load": [ + 2.89, + 3.09, + 3.25 + ], + "load_last": [ + 3.12, + 3.11, + 3.25 + ], + "stable": true, + "answer": "f9c82dc7a44877fd" + }, + "L23": { + "first_s": 17.2166, + "warm_median_s": 17.2176, + "warm_min_s": 17.2037, + "warm_max_s": 17.2187, + "load": [ + 2.94, + 3.07, + 3.24 + ], + "load_last": [ + 2.51, + 2.92, + 3.17 + ], + "stable": true, + "answer": "f9cff73ec1dd0455" + }, + "L25": { + "first_s": 22.796, + "warm_median_s": 23.1685, + "warm_min_s": 23.0813, + "warm_max_s": 23.3299, + "load": [ + 2.28, + 2.85, + 3.14 + ], + "load_last": [ + 2.76, + 2.8, + 3.09 + ], + "stable": true, + "answer": "70646b6616899176" + }, + "S0": { + "first_s": 1.0145, + "warm_median_s": 1.0223, + "warm_min_s": 1.0175, + "warm_max_s": 1.0354, + "load": [ + 2.64, + 2.77, + 3.07 + ], + "load_last": [ + 2.59, + 2.75, + 3.06 + ], + "stable": true, + "answer": "0d2cb0656ce580c7" + }, + "S1": { + "first_s": 4.673, + "warm_median_s": 4.675, + "warm_min_s": 4.6213, + "warm_max_s": 4.6885, + "load": [ + 2.59, + 2.75, + 3.06 + ], + "load_last": [ + 2.54, + 2.73, + 3.05 + ], + "stable": true, + "answer": "ebdf28564c404722" + }, + "S2": { + "first_s": 4.8274, + "warm_median_s": 4.8091, + "warm_min_s": 4.8058, + "warm_max_s": 4.819, + "load": [ + 2.58, + 2.74, + 3.05 + ], + "load_last": [ + 2.23, + 2.65, + 3.01 + ], + "stable": true, + "answer": "e291bf8af6f3ad65" + }, + "S3": { + "first_s": 9.7371, + "warm_median_s": 9.6765, + "warm_min_s": 9.6747, + "warm_max_s": 9.7147, + "load": [ + 2.13, + 2.62, + 3.0 + ], + "load_last": [ + 2.01, + 2.55, + 2.96 + ], + "stable": true, + "answer": "32ee6933a75f4cc5" + }, + "S4": { + "first_s": 14.2652, + "warm_median_s": 14.3031, + "warm_min_s": 14.2764, + "warm_max_s": 14.3601, + "load": [ + 2.17, + 2.57, + 2.97 + ], + "load_last": [ + 2.21, + 2.53, + 2.93 + ], + "stable": true, + "answer": "3a8819936f0fa436" + }, + "S5": { + "first_s": 18.691, + "warm_median_s": 18.6695, + "warm_min_s": 18.6608, + "warm_max_s": 18.8103, + "load": [ + 2.24, + 2.52, + 2.92 + ], + "load_last": [ + 1.99, + 2.4, + 2.85 + ], + "stable": true, + "answer": "38333b798f280324" + } + } + }, + "paths-scores": { + "queries": 5, + "median_of_warm_medians_s": 5.4672, + "min_s": 1.2227, + "max_s": 18.8928, + "load_1min_range": [ + 1.86, + 4.5 + ], + "per_query": { + "L0": { + "first_s": 1.2001, + "warm_median_s": 1.2227, + "warm_min_s": 1.2069, + "warm_max_s": 1.2528, + "load": [ + 1.86, + 2.34, + 2.81 + ], + "load_last": [ + 1.87, + 2.34, + 2.81 + ], + "stable": true, + "answer": "4f53cda18c2baa0c" + }, + "L6": { + "first_s": 2.2762, + "warm_median_s": 2.2468, + "warm_min_s": 2.2459, + "warm_max_s": 2.2562, + "load": [ + 1.87, + 2.34, + 2.81 + ], + "load_last": [ + 1.96, + 2.35, + 2.81 + ], + "stable": true, + "answer": "fbb18d5391251239" + }, + "L11": { + "first_s": 5.4313, + "warm_median_s": 5.4672, + "warm_min_s": 5.4307, + "warm_max_s": 5.4885, + "load": [ + 1.97, + 2.34, + 2.81 + ], + "load_last": [ + 2.58, + 2.46, + 2.84 + ], + "stable": true, + "answer": "c1852a5e85df4b1d" + }, + "L17": { + "first_s": 7.6923, + "warm_median_s": 7.6292, + "warm_min_s": 7.6223, + "warm_max_s": 7.6965, + "load": [ + 3.26, + 2.6, + 2.89 + ], + "load_last": [ + 3.15, + 2.63, + 2.89 + ], + "stable": true, + "answer": "fc5ddb623b636ebc" + }, + "L23": { + "first_s": 15.4336, + "warm_median_s": 18.8928, + "warm_min_s": 15.1211, + "warm_max_s": 21.3006, + "load": [ + 3.3, + 2.67, + 2.9 + ], + "load_last": [ + 3.87, + 2.96, + 2.99 + ], + "stable": true, + "answer": "84ae68b25529f27f" + } + } + }, + "paths-search": { + "queries": 5, + "median_of_warm_medians_s": 8.429, + "min_s": 2.334, + "max_s": 15.7038, + "load_1min_range": [ + 3.12, + 4.17 + ], + "per_query": { + "L0": { + "first_s": 3.3852, + "warm_median_s": 2.6919, + "warm_min_s": 1.2471, + "warm_max_s": 3.5899, + "load": [ + 3.84, + 2.99, + 3.01 + ], + "load_last": [ + 3.92, + 3.04, + 3.02 + ], + "stable": true, + "answer": "4f53cda18c2baa0c" + }, + "L6": { + "first_s": 2.3131, + "warm_median_s": 2.334, + "warm_min_s": 2.2931, + "warm_max_s": 2.3908, + "load": [ + 3.92, + 3.04, + 3.02 + ], + "load_last": [ + 3.62, + 3.01, + 3.01 + ], + "stable": true, + "answer": "34c3fc5d495f9373" + }, + "L11": { + "first_s": 9.4985, + "warm_median_s": 8.429, + "warm_min_s": 6.3187, + "warm_max_s": 12.5648, + "load": [ + 3.62, + 3.01, + 3.01 + ], + "load_last": [ + 3.53, + 3.04, + 3.02 + ], + "stable": true, + "answer": "a02d8d72fe9fc718" + }, + "L17": { + "first_s": 7.7133, + "warm_median_s": 15.3856, + "warm_min_s": 14.8818, + "warm_max_s": 17.8132, + "load": [ + 3.44, + 3.04, + 3.02 + ], + "load_last": [ + 3.12, + 3.0, + 3.0 + ], + "stable": true, + "answer": "35449edca71ade6a" + }, + "L23": { + "first_s": 16.2867, + "warm_median_s": 15.7038, + "warm_min_s": 15.3734, + "warm_max_s": 15.8254, + "load": [ + 3.25, + 3.03, + 3.01 + ], + "load_last": [ + 3.77, + 3.2, + 3.07 + ], + "stable": true, + "answer": "2244045ae40dfaf0" + } + } + } + }, + "fresh": { + "free-class/L0": { + "query_s": [ + 1.4571, + 1.54, + 1.6105 + ], + "open_s": [ + 0.00059, + 0.0005, + 0.00066 + ], + "peak_rss_mb": [ + 70.5, + 71.2, + 71.2 + ], + "load": [ + 3.3, + 3.28, + 3.28 + ], + "answers": [ + "71417a323b7f309d" + ], + "errors": 0 + }, + "free-class/L11": { + "query_s": [ + 9.0948, + 10.295, + 10.8667 + ], + "open_s": [ + 0.00055, + 0.00063, + 0.00062 + ], + "peak_rss_mb": [ + 446.5, + 447.1, + 447.7 + ], + "load": [ + 3.26, + 3.06, + 3.13 + ], + "answers": [ + "5562995b852b99bc" + ], + "errors": 0 + }, + "free-class/L23": { + "query_s": [ + 24.3714, + 24.3524, + 24.0956 + ], + "open_s": [ + 0.00068, + 0.00059, + 0.00055 + ], + "peak_rss_mb": [ + 467.7, + 467.9, + 469.3 + ], + "load": [ + 3.12, + 3.17, + 3.12 + ], + "answers": [ + "f9cff73ec1dd0455" + ], + "errors": 0 + }, + "paths-scores/L0": { + "query_s": [ + 1.2085, + 1.2213, + 1.2116 + ], + "open_s": [ + 0.00061, + 0.00061, + 0.00062 + ], + "peak_rss_mb": [ + 71.8, + 70.7, + 70.2 + ], + "load": [ + 2.61, + 2.61, + 2.61 + ], + "answers": [ + "4f53cda18c2baa0c" + ], + "errors": 0 + }, + "paths-scores/L11": { + "query_s": [ + 5.4571, + 5.462, + 5.4535 + ], + "open_s": [ + 0.0006, + 0.00062, + 0.00064 + ], + "peak_rss_mb": [ + 71.5, + 70.9, + 70.4 + ], + "load": [ + 2.56, + 2.44, + 2.4 + ], + "answers": [ + "c1852a5e85df4b1d" + ], + "errors": 0 + }, + "paths-scores/L23": { + "query_s": [ + 15.1719, + 15.152, + 15.132 + ], + "open_s": [ + 0.0006, + 0.00062, + 0.00059 + ], + "peak_rss_mb": [ + 70.7, + 70.6, + 70.6 + ], + "load": [ + 2.29, + 2.16, + 1.98 + ], + "answers": [ + "84ae68b25529f27f" + ], + "errors": 0 + } + } + }, + "after": { + "open_s": 114.5182, + "open_load": [ + 2.38, + 2.79, + 3.05 + ], + "units_current": 1369944, + "paths": 400, + "tokenizer": "runs/raw/lower/nomarks/unicode-17.0.0", + "class": "observed", + "queries": { + "L0": { + "terms": 1, + "postings": 108 + }, + "L3": { + "terms": 2, + "postings": 26949 + }, + "L6": { + "terms": 2, + "postings": 191032 + }, + "L8": { + "terms": 10, + "postings": 498437 + }, + "L11": { + "terms": 5, + "postings": 1337195 + }, + "L14": { + "terms": 10, + "postings": 1860446 + }, + "L17": { + "terms": 7, + "postings": 2671741 + }, + "L20": { + "terms": 9, + "postings": 3801316 + }, + "L23": { + "terms": 14, + "postings": 4966503 + }, + "L25": { + "terms": 19, + "postings": 6503751 + }, + "S0": { + "terms": 1, + "postings": 32 + }, + "S1": { + "terms": 3, + "postings": 1224831 + }, + "S2": { + "terms": 4, + "postings": 890406 + }, + "S3": { + "terms": 9, + "postings": 1378417 + }, + "S4": { + "terms": 12, + "postings": 3283060 + }, + "S5": { + "terms": 17, + "postings": 3338954 + } + }, + "shapes": { + "free-class": { + "queries": 16, + "median_of_warm_medians_s": 1.1973, + "min_s": 0.0001, + "max_s": 5.8729, + "load_1min_range": [ + 2.21, + 11.33 + ], + "per_query": { + "L0": { + "first_s": 0.0005, + "warm_median_s": 0.0001, + "warm_min_s": 0.0001, + "warm_max_s": 0.0002, + "load": [ + 2.26, + 2.59, + 2.94 + ], + "load_last": [ + 2.26, + 2.59, + 2.94 + ], + "stable": true, + "answer": "71417a323b7f309d" + }, + "L3": { + "first_s": 0.022, + "warm_median_s": 0.0215, + "warm_min_s": 0.0213, + "warm_max_s": 0.022, + "load": [ + 2.26, + 2.59, + 2.94 + ], + "load_last": [ + 2.26, + 2.59, + 2.94 + ], + "stable": true, + "answer": "3671f6681d39908b" + }, + "L6": { + "first_s": 0.1586, + "warm_median_s": 0.1581, + "warm_min_s": 0.1569, + "warm_max_s": 0.1582, + "load": [ + 2.26, + 2.59, + 2.94 + ], + "load_last": [ + 2.26, + 2.59, + 2.94 + ], + "stable": true, + "answer": "73b64c8a00b3b2ce" + }, + "L8": { + "first_s": 0.6058, + "warm_median_s": 0.607, + "warm_min_s": 0.5963, + "warm_max_s": 0.6073, + "load": [ + 2.26, + 2.59, + 2.94 + ], + "load_last": [ + 2.26, + 2.59, + 2.94 + ], + "stable": true, + "answer": "6df6bf83f8dbf6e6" + }, + "L11": { + "first_s": 1.0179, + "warm_median_s": 1.0163, + "warm_min_s": 1.0133, + "warm_max_s": 1.0197, + "load": [ + 2.26, + 2.59, + 2.94 + ], + "load_last": [ + 2.32, + 2.6, + 2.94 + ], + "stable": true, + "answer": "5562995b852b99bc" + }, + "L14": { + "first_s": 1.7982, + "warm_median_s": 1.7975, + "warm_min_s": 1.7918, + "warm_max_s": 1.8027, + "load": [ + 2.32, + 2.6, + 2.94 + ], + "load_last": [ + 2.21, + 2.57, + 2.93 + ], + "stable": true, + "answer": "4832dbce59a93911" + }, + "L17": { + "first_s": 2.0531, + "warm_median_s": 2.0512, + "warm_min_s": 2.0464, + "warm_max_s": 2.0602, + "load": [ + 6.92, + 3.54, + 3.27 + ], + "load_last": [ + 11.33, + 4.51, + 3.61 + ], + "stable": true, + "answer": "f2ec600743c6563d" + }, + "L20": { + "first_s": 2.8667, + "warm_median_s": 2.8598, + "warm_min_s": 2.8597, + "warm_max_s": 2.8772, + "load": [ + 11.33, + 4.51, + 3.61 + ], + "load_last": [ + 9.97, + 4.45, + 3.6 + ], + "stable": true, + "answer": "f9c82dc7a44877fd" + }, + "L23": { + "first_s": 4.2059, + "warm_median_s": 4.1464, + "warm_min_s": 4.1331, + "warm_max_s": 4.1862, + "load": [ + 9.41, + 4.42, + 3.59 + ], + "load_last": [ + 8.27, + 4.34, + 3.57 + ], + "stable": true, + "answer": "f9cff73ec1dd0455" + }, + "L25": { + "first_s": 5.9353, + "warm_median_s": 5.8729, + "warm_min_s": 5.8536, + "warm_max_s": 5.8797, + "load": [ + 8.01, + 4.35, + 3.58 + ], + "load_last": [ + 8.99, + 4.78, + 3.75 + ], + "stable": true, + "answer": "70646b6616899176" + }, + "S0": { + "first_s": 0.0002, + "warm_median_s": 0.0001, + "warm_min_s": 0.0001, + "warm_max_s": 0.0001, + "load": [ + 8.0, + 4.71, + 3.73 + ], + "load_last": [ + 8.0, + 4.71, + 3.73 + ], + "stable": true, + "answer": "0d2cb0656ce580c7" + }, + "S1": { + "first_s": 0.8158, + "warm_median_s": 0.8236, + "warm_min_s": 0.8118, + "warm_max_s": 0.8362, + "load": [ + 8.0, + 4.71, + 3.73 + ], + "load_last": [ + 8.0, + 4.71, + 3.73 + ], + "stable": true, + "answer": "ebdf28564c404722" + }, + "S2": { + "first_s": 0.7028, + "warm_median_s": 0.6996, + "warm_min_s": 0.6946, + "warm_max_s": 0.706, + "load": [ + 8.0, + 4.71, + 3.73 + ], + "load_last": [ + 7.76, + 4.71, + 3.74 + ], + "stable": true, + "answer": "e291bf8af6f3ad65" + }, + "S3": { + "first_s": 1.3578, + "warm_median_s": 1.3783, + "warm_min_s": 1.3647, + "warm_max_s": 1.3833, + "load": [ + 7.76, + 4.71, + 3.74 + ], + "load_last": [ + 7.54, + 4.72, + 3.75 + ], + "stable": true, + "answer": "32ee6933a75f4cc5" + }, + "S4": { + "first_s": 2.8447, + "warm_median_s": 2.7957, + "warm_min_s": 2.7888, + "warm_max_s": 2.805, + "load": [ + 7.54, + 4.72, + 3.75 + ], + "load_last": [ + 6.68, + 4.63, + 3.73 + ], + "stable": true, + "answer": "3a8819936f0fa436" + }, + "S5": { + "first_s": 3.4096, + "warm_median_s": 3.4161, + "warm_min_s": 3.4071, + "warm_max_s": 3.4192, + "load": [ + 6.68, + 4.63, + 3.73 + ], + "load_last": [ + 5.96, + 4.54, + 3.71 + ], + "stable": true, + "answer": "38333b798f280324" + } + } + }, + "free-all": { + "queries": 16, + "median_of_warm_medians_s": 1.1557, + "min_s": 0.0001, + "max_s": 5.6968, + "load_1min_range": [ + 2.46, + 5.57 + ], + "per_query": { + "L0": { + "first_s": 0.0005, + "warm_median_s": 0.0001, + "warm_min_s": 0.0001, + "warm_max_s": 0.0001, + "load": [ + 5.57, + 4.48, + 3.69 + ], + "load_last": [ + 5.57, + 4.48, + 3.69 + ], + "stable": true, + "answer": "71417a323b7f309d" + }, + "L3": { + "first_s": 0.0229, + "warm_median_s": 0.0228, + "warm_min_s": 0.0224, + "warm_max_s": 0.0229, + "load": [ + 5.57, + 4.48, + 3.69 + ], + "load_last": [ + 5.57, + 4.48, + 3.69 + ], + "stable": true, + "answer": "3671f6681d39908b" + }, + "L6": { + "first_s": 0.163, + "warm_median_s": 0.1639, + "warm_min_s": 0.1616, + "warm_max_s": 0.1644, + "load": [ + 5.57, + 4.48, + 3.69 + ], + "load_last": [ + 5.57, + 4.48, + 3.69 + ], + "stable": true, + "answer": "73b64c8a00b3b2ce" + }, + "L8": { + "first_s": 0.6005, + "warm_median_s": 0.5868, + "warm_min_s": 0.5848, + "warm_max_s": 0.598, + "load": [ + 5.57, + 4.48, + 3.69 + ], + "load_last": [ + 5.57, + 4.48, + 3.69 + ], + "stable": true, + "answer": "6df6bf83f8dbf6e6" + }, + "L11": { + "first_s": 0.9764, + "warm_median_s": 0.9763, + "warm_min_s": 0.9737, + "warm_max_s": 0.9877, + "load": [ + 5.52, + 4.49, + 3.7 + ], + "load_last": [ + 5.52, + 4.49, + 3.7 + ], + "stable": true, + "answer": "5562995b852b99bc" + }, + "L14": { + "first_s": 1.7358, + "warm_median_s": 1.7493, + "warm_min_s": 1.7351, + "warm_max_s": 1.7518, + "load": [ + 5.52, + 4.49, + 3.7 + ], + "load_last": [ + 5.32, + 4.46, + 3.69 + ], + "stable": true, + "answer": "4832dbce59a93911" + }, + "L17": { + "first_s": 1.9948, + "warm_median_s": 1.9905, + "warm_min_s": 1.9836, + "warm_max_s": 1.9912, + "load": [ + 5.05, + 4.42, + 3.68 + ], + "load_last": [ + 4.89, + 4.4, + 3.68 + ], + "stable": true, + "answer": "f2ec600743c6563d" + }, + "L20": { + "first_s": 2.7681, + "warm_median_s": 2.7728, + "warm_min_s": 2.7691, + "warm_max_s": 2.7743, + "load": [ + 4.89, + 4.4, + 3.68 + ], + "load_last": [ + 4.67, + 4.37, + 3.68 + ], + "stable": true, + "answer": "f9c82dc7a44877fd" + }, + "L23": { + "first_s": 4.0138, + "warm_median_s": 4.0082, + "warm_min_s": 3.9988, + "warm_max_s": 4.0099, + "load": [ + 4.67, + 4.37, + 3.68 + ], + "load_last": [ + 4.17, + 4.27, + 3.65 + ], + "stable": true, + "answer": "f9cff73ec1dd0455" + }, + "L25": { + "first_s": 5.7078, + "warm_median_s": 5.6968, + "warm_min_s": 5.6919, + "warm_max_s": 5.7065, + "load": [ + 3.91, + 4.21, + 3.64 + ], + "load_last": [ + 3.35, + 4.07, + 3.6 + ], + "stable": true, + "answer": "70646b6616899176" + }, + "S0": { + "first_s": 0.0002, + "warm_median_s": 0.0001, + "warm_min_s": 0.0001, + "warm_max_s": 0.0001, + "load": [ + 3.24, + 4.04, + 3.59 + ], + "load_last": [ + 3.24, + 4.04, + 3.59 + ], + "stable": true, + "answer": "0d2cb0656ce580c7" + }, + "S1": { + "first_s": 0.7851, + "warm_median_s": 0.787, + "warm_min_s": 0.7835, + "warm_max_s": 0.7878, + "load": [ + 3.24, + 4.04, + 3.59 + ], + "load_last": [ + 3.22, + 4.02, + 3.58 + ], + "stable": true, + "answer": "ebdf28564c404722" + }, + "S2": { + "first_s": 0.6682, + "warm_median_s": 0.6667, + "warm_min_s": 0.6631, + "warm_max_s": 0.6722, + "load": [ + 3.22, + 4.02, + 3.58 + ], + "load_last": [ + 3.22, + 4.02, + 3.58 + ], + "stable": true, + "answer": "e291bf8af6f3ad65" + }, + "S3": { + "first_s": 1.3104, + "warm_median_s": 1.3352, + "warm_min_s": 1.318, + "warm_max_s": 1.3379, + "load": [ + 3.22, + 4.02, + 3.58 + ], + "load_last": [ + 3.04, + 3.97, + 3.57 + ], + "stable": true, + "answer": "32ee6933a75f4cc5" + }, + "S4": { + "first_s": 2.7399, + "warm_median_s": 2.7463, + "warm_min_s": 2.7463, + "warm_max_s": 2.7807, + "load": [ + 3.04, + 3.97, + 3.57 + ], + "load_last": [ + 2.73, + 3.87, + 3.54 + ], + "stable": true, + "answer": "3a8819936f0fa436" + }, + "S5": { + "first_s": 3.3532, + "warm_median_s": 3.362, + "warm_min_s": 3.3481, + "warm_max_s": 3.3648, + "load": [ + 2.59, + 3.82, + 3.52 + ], + "load_last": [ + 2.5, + 3.76, + 3.5 + ], + "stable": true, + "answer": "38333b798f280324" + } + } + }, + "paths-scores": { + "queries": 5, + "median_of_warm_medians_s": 0.0055, + "min_s": 0.0019, + "max_s": 0.0121, + "load_1min_range": [ + 2.5, + 2.5 + ], + "per_query": { + "L0": { + "first_s": 0.0147, + "warm_median_s": 0.0019, + "warm_min_s": 0.0018, + "warm_max_s": 0.0021, + "load": [ + 2.5, + 3.76, + 3.5 + ], + "load_last": [ + 2.5, + 3.76, + 3.5 + ], + "stable": true, + "answer": "4f53cda18c2baa0c" + }, + "L6": { + "first_s": 0.0032, + "warm_median_s": 0.0029, + "warm_min_s": 0.0029, + "warm_max_s": 0.0029, + "load": [ + 2.5, + 3.76, + 3.5 + ], + "load_last": [ + 2.5, + 3.76, + 3.5 + ], + "stable": true, + "answer": "fbb18d5391251239" + }, + "L11": { + "first_s": 0.0061, + "warm_median_s": 0.0055, + "warm_min_s": 0.0055, + "warm_max_s": 0.0059, + "load": [ + 2.5, + 3.76, + 3.5 + ], + "load_last": [ + 2.5, + 3.76, + 3.5 + ], + "stable": true, + "answer": "c1852a5e85df4b1d" + }, + "L17": { + "first_s": 0.0081, + "warm_median_s": 0.0076, + "warm_min_s": 0.0075, + "warm_max_s": 0.0077, + "load": [ + 2.5, + 3.76, + 3.5 + ], + "load_last": [ + 2.5, + 3.76, + 3.5 + ], + "stable": true, + "answer": "fc5ddb623b636ebc" + }, + "L23": { + "first_s": 0.0127, + "warm_median_s": 0.0121, + "warm_min_s": 0.0121, + "warm_max_s": 0.0124, + "load": [ + 2.5, + 3.76, + 3.5 + ], + "load_last": [ + 2.5, + 3.76, + 3.5 + ], + "stable": true, + "answer": "84ae68b25529f27f" + } + } + }, + "paths-search": { + "queries": 5, + "median_of_warm_medians_s": 0.0046, + "min_s": 0.0018, + "max_s": 0.0111, + "load_1min_range": [ + 2.5, + 2.5 + ], + "per_query": { + "L0": { + "first_s": 0.002, + "warm_median_s": 0.0018, + "warm_min_s": 0.0018, + "warm_max_s": 0.0019, + "load": [ + 2.5, + 3.76, + 3.5 + ], + "load_last": [ + 2.5, + 3.76, + 3.5 + ], + "stable": true, + "answer": "4f53cda18c2baa0c" + }, + "L6": { + "first_s": 0.003, + "warm_median_s": 0.0026, + "warm_min_s": 0.0026, + "warm_max_s": 0.0028, + "load": [ + 2.5, + 3.76, + 3.5 + ], + "load_last": [ + 2.5, + 3.76, + 3.5 + ], + "stable": true, + "answer": "34c3fc5d495f9373" + }, + "L11": { + "first_s": 0.005, + "warm_median_s": 0.0046, + "warm_min_s": 0.0046, + "warm_max_s": 0.0046, + "load": [ + 2.5, + 3.76, + 3.5 + ], + "load_last": [ + 2.5, + 3.76, + 3.5 + ], + "stable": true, + "answer": "a02d8d72fe9fc718" + }, + "L17": { + "first_s": 0.0073, + "warm_median_s": 0.0066, + "warm_min_s": 0.0065, + "warm_max_s": 0.0068, + "load": [ + 2.5, + 3.76, + 3.5 + ], + "load_last": [ + 2.5, + 3.76, + 3.5 + ], + "stable": true, + "answer": "35449edca71ade6a" + }, + "L23": { + "first_s": 0.0121, + "warm_median_s": 0.0111, + "warm_min_s": 0.011, + "warm_max_s": 0.0114, + "load": [ + 2.5, + 3.76, + 3.5 + ], + "load_last": [ + 2.5, + 3.76, + 3.5 + ], + "stable": true, + "answer": "2244045ae40dfaf0" + } + } + } + }, + "fresh": { + "free-class/L0": { + "query_s": [ + 0.0005, + 0.0005, + 0.0005 + ], + "open_s": [ + 0.00066, + 0.00066, + 0.00065 + ], + "peak_rss_mb": [ + 68.7, + 68.6, + 68.7 + ], + "load": [ + 2.5, + 2.38, + 2.38 + ], + "answers": [ + "71417a323b7f309d" + ], + "errors": 0 + }, + "free-class/L11": { + "query_s": [ + 0.9245, + 0.936, + 0.9237 + ], + "open_s": [ + 0.00065, + 0.00069, + 0.00067 + ], + "peak_rss_mb": [ + 72.5, + 73.2, + 73.3 + ], + "load": [ + 2.38, + 2.38, + 2.38 + ], + "answers": [ + "5562995b852b99bc" + ], + "errors": 0 + }, + "free-class/L23": { + "query_s": [ + 3.9624, + 3.95, + 3.9689 + ], + "open_s": [ + 0.00064, + 0.00061, + 0.00067 + ], + "peak_rss_mb": [ + 74.6, + 73.3, + 73.8 + ], + "load": [ + 2.27, + 2.27, + 2.41 + ], + "answers": [ + "f9cff73ec1dd0455" + ], + "errors": 0 + }, + "paths-scores/L0": { + "query_s": [ + 0.0044, + 0.0042, + 0.0028 + ], + "open_s": [ + 0.00065, + 0.0006, + 0.00062 + ], + "peak_rss_mb": [ + 70.9, + 70.7, + 71.1 + ], + "load": [ + 2.54, + 2.54, + 2.54 + ], + "answers": [ + "4f53cda18c2baa0c" + ], + "errors": 0 + }, + "paths-scores/L11": { + "query_s": [ + 0.0068, + 0.0085, + 0.0067 + ], + "open_s": [ + 0.00065, + 0.00065, + 0.00064 + ], + "peak_rss_mb": [ + 70.8, + 71.1, + 71.8 + ], + "load": [ + 2.54, + 2.65, + 2.65 + ], + "answers": [ + "c1852a5e85df4b1d" + ], + "errors": 0 + }, + "paths-scores/L23": { + "query_s": [ + 0.0153, + 0.0156, + 0.0156 + ], + "open_s": [ + 0.00063, + 0.00063, + 0.00061 + ], + "peak_rss_mb": [ + 70.0, + 70.2, + 70.8 + ], + "load": [ + 2.65, + 2.65, + 2.65 + ], + "answers": [ + "84ae68b25529f27f" + ], + "errors": 0 + } + } + } + }, + "ledger": { + "before": { + "open_s": 0.0003, + "records": 387838, + "singles": { + "producers_of": { + "median_warm_s": 2.47016, + "median_first_s": 2.467617, + "per_digest": { + "0": { + "first_s": 2.467617, + "warm_median_s": 2.409049, + "present": true, + "answer": "281f45dcb33affb2", + "load": [ + 2.19, + 2.74, + 2.9 + ] + }, + "1": { + "first_s": 2.476891, + "warm_median_s": 2.48614, + "present": true, + "answer": "88abfc17e37bdd72", + "load": [ + 2.08, + 2.7, + 2.89 + ] + }, + "2": { + "first_s": 2.463434, + "warm_median_s": 2.47016, + "present": true, + "answer": "cd20b882c9cd5aad", + "load": [ + 2.14, + 2.69, + 2.88 + ] + }, + "3": { + "first_s": 2.490094, + "warm_median_s": 2.573428, + "present": true, + "answer": "6cce75eb80035638", + "load": [ + 2.37, + 2.72, + 2.89 + ] + }, + "4": { + "first_s": 2.371198, + "warm_median_s": 2.466018, + "present": true, + "answer": "5f3aacf70de1131f", + "load": [ + 2.3, + 2.69, + 2.88 + ] + }, + "5": { + "first_s": 2.471471, + "warm_median_s": 2.471456, + "present": false, + "answer": "4f53cda18c2baa0c", + "load": [ + 2.64, + 2.75, + 2.9 + ] + }, + "6": { + "first_s": 2.467505, + "warm_median_s": 2.45592, + "present": false, + "answer": "4f53cda18c2baa0c", + "load": [ + 2.55, + 2.73, + 2.89 + ] + } + } + }, + "already_attested": { + "median_warm_s": 2.477536, + "median_first_s": 2.444026, + "per_digest": { + "0": { + "first_s": 2.441154, + "warm_median_s": 2.393911, + "present": true, + "answer": "b5bea41b6c623f7c", + "load": [ + 2.31, + 2.67, + 2.86 + ] + }, + "1": { + "first_s": 2.454352, + "warm_median_s": 2.479187, + "present": true, + "answer": "b5bea41b6c623f7c", + "load": [ + 2.42, + 2.68, + 2.87 + ] + }, + "2": { + "first_s": 2.444026, + "warm_median_s": 2.487201, + "present": true, + "answer": "b5bea41b6c623f7c", + "load": [ + 2.47, + 2.69, + 2.87 + ] + }, + "3": { + "first_s": 2.42742, + "warm_median_s": 2.406151, + "present": true, + "answer": "b5bea41b6c623f7c", + "load": [ + 2.71, + 2.73, + 2.88 + ] + }, + "4": { + "first_s": 2.365487, + "warm_median_s": 2.490428, + "present": true, + "answer": "b5bea41b6c623f7c", + "load": [ + 2.52, + 2.69, + 2.86 + ] + }, + "5": { + "first_s": 2.452815, + "warm_median_s": 2.477536, + "present": false, + "answer": "fcbcf165908dd18a", + "load": [ + 2.44, + 2.67, + 2.85 + ] + }, + "6": { + "first_s": 2.502183, + "warm_median_s": 2.467049, + "present": false, + "answer": "fcbcf165908dd18a", + "load": [ + 2.52, + 2.68, + 2.85 + ] + } + } + }, + "attested_by": { + "median_warm_s": 2.478245, + "median_first_s": 2.475747, + "per_digest": { + "0": { + "first_s": 2.475747, + "warm_median_s": 2.457617, + "present": true, + "answer": "281f45dcb33affb2", + "load": [ + 2.43, + 2.65, + 2.84 + ] + }, + "1": { + "first_s": 2.54572, + "warm_median_s": 2.478245, + "present": true, + "answer": "88abfc17e37bdd72", + "load": [ + 2.44, + 2.65, + 2.84 + ] + }, + "2": { + "first_s": 2.484415, + "warm_median_s": 2.493958, + "present": true, + "answer": "cd20b882c9cd5aad", + "load": [ + 2.66, + 2.69, + 2.85 + ] + }, + "3": { + "first_s": 2.444998, + "warm_median_s": 2.417901, + "present": true, + "answer": "6cce75eb80035638", + "load": [ + 3.2, + 2.8, + 2.89 + ] + }, + "4": { + "first_s": 2.498799, + "warm_median_s": 2.510918, + "present": true, + "answer": "5f3aacf70de1131f", + "load": [ + 3.09, + 2.79, + 2.88 + ] + }, + "5": { + "first_s": 2.442021, + "warm_median_s": 2.492303, + "present": false, + "answer": "4f53cda18c2baa0c", + "load": [ + 2.92, + 2.76, + 2.87 + ] + }, + "6": { + "first_s": 2.429864, + "warm_median_s": 2.421569, + "present": false, + "answer": "4f53cda18c2baa0c", + "load": [ + 2.86, + 2.75, + 2.87 + ] + } + } + } + }, + "batch": { + "digests": 2050, + "producers_by_output": { + "first_s": 0.2946, + "warm_median_s": 0.3042, + "warm_min_s": 0.29734, + "warm_max_s": 0.30785, + "load": [ + 2.73, + 2.73, + 2.85 + ], + "answer": "163d91689d798f2a" + }, + "attested_batch": { + "first_s": 0.30112, + "warm_median_s": 0.30496, + "warm_min_s": 0.30421, + "warm_max_s": 0.30652, + "load": [ + 2.73, + 2.73, + 2.85 + ], + "answer": "163d91689d798f2a" + } + } + }, + "after": { + "open_s": 1.8234, + "records": 387838, + "singles": { + "producers_of": { + "median_warm_s": 7e-06, + "median_first_s": 1e-05, + "per_digest": { + "0": { + "first_s": 6.3e-05, + "warm_median_s": 1.3e-05, + "present": true, + "answer": "281f45dcb33affb2", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "1": { + "first_s": 1.2e-05, + "warm_median_s": 7e-06, + "present": true, + "answer": "88abfc17e37bdd72", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "2": { + "first_s": 1e-05, + "warm_median_s": 7e-06, + "present": true, + "answer": "cd20b882c9cd5aad", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "3": { + "first_s": 9e-06, + "warm_median_s": 7e-06, + "present": true, + "answer": "6cce75eb80035638", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "4": { + "first_s": 1e-05, + "warm_median_s": 7e-06, + "present": true, + "answer": "5f3aacf70de1131f", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "5": { + "first_s": 9e-06, + "warm_median_s": 6e-06, + "present": false, + "answer": "4f53cda18c2baa0c", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "6": { + "first_s": 9e-06, + "warm_median_s": 6e-06, + "present": false, + "answer": "4f53cda18c2baa0c", + "load": [ + 2.65, + 3.69, + 3.48 + ] + } + } + }, + "already_attested": { + "median_warm_s": 8e-06, + "median_first_s": 9e-06, + "per_digest": { + "0": { + "first_s": 2.7e-05, + "warm_median_s": 9e-06, + "present": true, + "answer": "b5bea41b6c623f7c", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "1": { + "first_s": 9e-06, + "warm_median_s": 8e-06, + "present": true, + "answer": "b5bea41b6c623f7c", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "2": { + "first_s": 9e-06, + "warm_median_s": 8e-06, + "present": true, + "answer": "b5bea41b6c623f7c", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "3": { + "first_s": 8e-06, + "warm_median_s": 8e-06, + "present": true, + "answer": "b5bea41b6c623f7c", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "4": { + "first_s": 9e-06, + "warm_median_s": 8e-06, + "present": true, + "answer": "b5bea41b6c623f7c", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "5": { + "first_s": 8e-06, + "warm_median_s": 7e-06, + "present": false, + "answer": "fcbcf165908dd18a", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "6": { + "first_s": 7e-06, + "warm_median_s": 7e-06, + "present": false, + "answer": "fcbcf165908dd18a", + "load": [ + 2.65, + 3.69, + 3.48 + ] + } + } + }, + "attested_by": { + "median_warm_s": 8e-06, + "median_first_s": 8e-06, + "per_digest": { + "0": { + "first_s": 9e-06, + "warm_median_s": 8e-06, + "present": true, + "answer": "281f45dcb33affb2", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "1": { + "first_s": 1.3e-05, + "warm_median_s": 8e-06, + "present": true, + "answer": "88abfc17e37bdd72", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "2": { + "first_s": 8e-06, + "warm_median_s": 8e-06, + "present": true, + "answer": "cd20b882c9cd5aad", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "3": { + "first_s": 1e-05, + "warm_median_s": 8e-06, + "present": true, + "answer": "6cce75eb80035638", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "4": { + "first_s": 8e-06, + "warm_median_s": 8e-06, + "present": true, + "answer": "5f3aacf70de1131f", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "5": { + "first_s": 7e-06, + "warm_median_s": 7e-06, + "present": false, + "answer": "4f53cda18c2baa0c", + "load": [ + 2.65, + 3.69, + 3.48 + ] + }, + "6": { + "first_s": 7e-06, + "warm_median_s": 7e-06, + "present": false, + "answer": "4f53cda18c2baa0c", + "load": [ + 2.65, + 3.69, + 3.48 + ] + } + } + } + }, + "batch": { + "digests": 2050, + "producers_by_output": { + "first_s": 0.00778, + "warm_median_s": 0.00592, + "warm_min_s": 0.00578, + "warm_max_s": 0.0078, + "load": [ + 2.65, + 3.69, + 3.48 + ], + "answer": "163d91689d798f2a" + }, + "attested_batch": { + "first_s": 0.00621, + "warm_median_s": 0.00604, + "warm_min_s": 0.0059, + "warm_max_s": 0.00633, + "load": [ + 2.65, + 3.69, + 3.48 + ], + "answer": "163d91689d798f2a" + } + } + } + }, + "landing": { + "before": [ + { + "open_s": { + "lexical": 0.001, + "catalog": 0.003, + "attestations": 0.0, + "versions": 0.0 + }, + "clone_s": 0.05, + "peak_rss_mb": 374.1, + "load_start": [ + 2.91, + 2.77, + 2.87 + ], + "batches": [ + { + "batch": 0, + "items": 2000, + "bytes": 5528205, + "land_s": 19.138, + "items_per_s": 104.5, + "load": [ + 2.76, + 2.74, + 2.86 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.281, + "derive": 0.479, + "index": 16.953, + "finish": 1.415 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.0626 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.7404 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.021 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.3319 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 16.9527 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3297 + } + }, + "ledger_grew": 2000, + "units_landed": 7386 + }, + { + "batch": 1, + "items": 2000, + "bytes": 4330924, + "land_s": 10.258, + "items_per_s": 195.0, + "load": [ + 2.39, + 2.66, + 2.82 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.287, + "derive": 0.434, + "index": 8.647, + "finish": 0.882 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.0613 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.415 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.0182 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.2015 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 8.6461 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3161 + } + }, + "ledger_grew": 2000, + "units_landed": 5938 + }, + { + "batch": 2, + "items": 2000, + "bytes": 5629222, + "land_s": 11.02, + "items_per_s": 181.5, + "load": [ + 2.42, + 2.65, + 2.82 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.28, + "derive": 0.462, + "index": 9.491, + "finish": 0.78 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.0516 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.404 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.0173 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.15 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 9.4902 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3121 + } + }, + "ledger_grew": 2000, + "units_landed": 7360 + } + ] + }, + { + "open_s": { + "lexical": 0.002, + "catalog": 0.001, + "attestations": 0.0, + "versions": 0.0 + }, + "clone_s": 0.04, + "peak_rss_mb": 375.5, + "load_start": [ + 2.25, + 2.6, + 2.8 + ], + "batches": [ + { + "batch": 0, + "items": 2000, + "bytes": 5797548, + "land_s": 16.964, + "items_per_s": 117.9, + "load": [ + 2.25, + 2.6, + 2.8 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.277, + "derive": 0.472, + "index": 14.951, + "finish": 1.255 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.0515 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.6809 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.0205 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.3004 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 14.9501 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3207 + } + }, + "ledger_grew": 2000, + "units_landed": 7626 + }, + { + "batch": 1, + "items": 2000, + "bytes": 5377381, + "land_s": 11.319, + "items_per_s": 176.7, + "load": [ + 2.16, + 2.56, + 2.78 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.278, + "derive": 0.45, + "index": 9.824, + "finish": 0.76 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.0518 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.3027 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.0169 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.2012 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 9.8232 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3096 + } + }, + "ledger_grew": 2000, + "units_landed": 7255 + }, + { + "batch": 2, + "items": 2000, + "bytes": 4855730, + "land_s": 10.176, + "items_per_s": 196.5, + "load": [ + 2.4, + 2.6, + 2.79 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.281, + "derive": 0.443, + "index": 8.628, + "finish": 0.816 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.0542 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.4168 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.0171 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.1441 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 8.6276 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3135 + } + }, + "ledger_grew": 2000, + "units_landed": 6570 + } + ] + }, + { + "open_s": { + "lexical": 0.002, + "catalog": 0.001, + "attestations": 0.0, + "versions": 0.0 + }, + "clone_s": 0.04, + "peak_rss_mb": 373.1, + "load_start": [ + 2.66, + 2.64, + 2.8 + ], + "batches": [ + { + "batch": 0, + "items": 2000, + "bytes": 4708283, + "land_s": 16.462, + "items_per_s": 121.5, + "load": [ + 2.69, + 2.65, + 2.8 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.276, + "derive": 0.455, + "index": 14.354, + "finish": 1.368 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.0572 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.7422 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.0204 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.3296 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 14.3536 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3269 + } + }, + "ledger_grew": 2000, + "units_landed": 6443 + }, + { + "batch": 1, + "items": 2000, + "bytes": 3931022, + "land_s": 10.038, + "items_per_s": 199.2, + "load": [ + 2.6, + 2.63, + 2.79 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.284, + "derive": 0.435, + "index": 8.522, + "finish": 0.79 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.0581 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.3181 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.0172 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.2089 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 8.5212 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3245 + } + }, + "ledger_grew": 2000, + "units_landed": 5438 + }, + { + "batch": 2, + "items": 2000, + "bytes": 5077113, + "land_s": 10.534, + "items_per_s": 189.9, + "load": [ + 2.51, + 2.61, + 2.78 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.278, + "derive": 0.444, + "index": 9.017, + "finish": 0.787 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.0509 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.4048 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.017 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.1405 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 9.0165 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3092 + } + }, + "ledger_grew": 2000, + "units_landed": 6826 + } + ] + } + ], + "after": [ + { + "open_s": { + "lexical": 118.877, + "catalog": 0.003, + "attestations": 2.455, + "versions": 0.003 + }, + "clone_s": 0.05, + "peak_rss_mb": 378.0, + "load_start": [ + 4.86, + 3.55, + 3.11 + ], + "batches": [ + { + "batch": 0, + "items": 2000, + "bytes": 5528205, + "land_s": 11.992, + "items_per_s": 166.8, + "load": [ + 3.53, + 3.49, + 3.15 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.238, + "derive": 0.471, + "index": 10.54, + "finish": 0.733 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.1058 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.006 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.021 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.3227 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 10.5377 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3235 + } + }, + "ledger_grew": 2000, + "units_landed": 7386 + }, + { + "batch": 1, + "items": 2000, + "bytes": 4330924, + "land_s": 9.513, + "items_per_s": 210.2, + "load": [ + 3.45, + 3.48, + 3.15 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.242, + "derive": 0.444, + "index": 8.236, + "finish": 0.583 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.1068 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.0055 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.0175 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.2168 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 8.2355 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3255 + } + }, + "ledger_grew": 2000, + "units_landed": 5938 + }, + { + "batch": 2, + "items": 2000, + "bytes": 5629222, + "land_s": 10.806, + "items_per_s": 185.1, + "load": [ + 3.37, + 3.46, + 3.15 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.243, + "derive": 0.485, + "index": 9.563, + "finish": 0.507 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.1059 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.0053 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.0175 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.1547 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 9.5621 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3316 + } + }, + "ledger_grew": 2000, + "units_landed": 7360 + } + ] + }, + { + "open_s": { + "lexical": 114.952, + "catalog": 0.008, + "attestations": 2.614, + "versions": 0.003 + }, + "clone_s": 0.04, + "peak_rss_mb": 377.9, + "load_start": [ + 3.85, + 3.56, + 3.19 + ], + "batches": [ + { + "batch": 0, + "items": 2000, + "bytes": 5797548, + "land_s": 11.868, + "items_per_s": 168.5, + "load": [ + 6.29, + 4.2, + 3.46 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.247, + "derive": 0.494, + "index": 10.419, + "finish": 0.696 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.1075 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.0054 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.022 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.3264 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 10.4188 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3397 + } + }, + "ledger_grew": 2000, + "units_landed": 7626 + }, + { + "batch": 1, + "items": 2000, + "bytes": 5377381, + "land_s": 10.905, + "items_per_s": 183.4, + "load": [ + 5.79, + 4.16, + 3.45 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.244, + "derive": 0.484, + "index": 9.515, + "finish": 0.654 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.1098 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.0054 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.0168 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.2312 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 9.5147 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3374 + } + }, + "ledger_grew": 2000, + "units_landed": 7255 + }, + { + "batch": 2, + "items": 2000, + "bytes": 4855730, + "land_s": 11.038, + "items_per_s": 181.2, + "load": [ + 5.17, + 4.1, + 3.44 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.252, + "derive": 0.468, + "index": 9.803, + "finish": 0.507 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.1139 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.0085 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.0175 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.1614 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 9.8003 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3335 + } + }, + "ledger_grew": 2000, + "units_landed": 6570 + } + ] + }, + { + "open_s": { + "lexical": 117.654, + "catalog": 0.009, + "attestations": 2.664, + "versions": 0.003 + }, + "clone_s": 0.04, + "peak_rss_mb": 374.4, + "load_start": [ + 4.68, + 4.04, + 3.44 + ], + "batches": [ + { + "batch": 0, + "items": 2000, + "bytes": 4708283, + "land_s": 10.915, + "items_per_s": 183.2, + "load": [ + 3.35, + 3.74, + 3.39 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.243, + "derive": 0.462, + "index": 9.477, + "finish": 0.722 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.1146 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.0057 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.021 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.3332 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 9.4752 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3331 + } + }, + "ledger_grew": 2000, + "units_landed": 6443 + }, + { + "batch": 1, + "items": 2000, + "bytes": 3931022, + "land_s": 9.156, + "items_per_s": 218.4, + "load": [ + 3.38, + 3.73, + 3.39 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.243, + "derive": 0.436, + "index": 7.848, + "finish": 0.621 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.1116 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.0071 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.0175 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.2268 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 7.8468 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3263 + } + }, + "ledger_grew": 2000, + "units_landed": 5438 + }, + { + "batch": 2, + "items": 2000, + "bytes": 5077113, + "land_s": 10.468, + "items_per_s": 191.1, + "load": [ + 3.48, + 3.74, + 3.4 + ], + "statuses": { + "landed": 2000 + }, + "stages_s": { + "admit": 0.242, + "derive": 0.472, + "index": 9.249, + "finish": 0.496 + }, + "calls": { + "attestations.append": { + "calls": 2000, + "seconds": 0.1106 + }, + "attestations.producers_by_output": { + "calls": 1, + "seconds": 0.0057 + }, + "catalog.get": { + "calls": 6000, + "seconds": 0.0174 + }, + "catalog.record": { + "calls": 2000, + "seconds": 0.1609 + }, + "lexical.land_many": { + "calls": 1, + "seconds": 9.2483 + }, + "raw.add": { + "calls": 2000, + "seconds": 0.3319 + } + }, + "ledger_grew": 2000, + "units_landed": 6826 + } + ] + } + ] + }, + "single": { + "before": [ + { + "open_s": { + "lexical": 0.002, + "catalog": 0.001, + "attestations": 0.0, + "versions": 0.0 + }, + "clone_s": 0.04, + "peak_rss_mb": 855.7, + "load_start": [ + 2.44, + 2.59, + 2.77 + ], + "batches": [ + { + "batch": 0, + "items": 3, + "bytes": 8134, + "land_s": 23.089, + "items_per_s": 0.1, + "load": [ + 2.44, + 2.59, + 2.77 + ], + "statuses": { + "landed": 3 + }, + "stages_s": {}, + "calls": { + "attestations.append": { + "calls": 3, + "seconds": 0.0045 + }, + "attestations.producers_of": { + "calls": 9, + "seconds": 22.9439 + }, + "catalog.record": { + "calls": 3, + "seconds": 0.0029 + }, + "lexical.land": { + "calls": 3, + "seconds": 0.133 + }, + "raw.add": { + "calls": 3, + "seconds": 0.0014 + } + }, + "ledger_grew": 3, + "units_landed": 9 + } + ] + } + ], + "after": [ + { + "open_s": { + "lexical": 120.318, + "catalog": 0.007, + "attestations": 2.668, + "versions": 0.004 + }, + "clone_s": 0.04, + "peak_rss_mb": 346.8, + "load_start": [ + 3.44, + 3.72, + 3.4 + ], + "batches": [ + { + "batch": 0, + "items": 3, + "bytes": 8134, + "land_s": 0.082, + "items_per_s": 36.4, + "load": [ + 3.28, + 3.49, + 3.34 + ], + "statuses": { + "landed": 3 + }, + "stages_s": {}, + "calls": { + "attestations.append": { + "calls": 3, + "seconds": 0.0023 + }, + "catalog.get": { + "calls": 9, + "seconds": 0.0011 + }, + "catalog.record": { + "calls": 3, + "seconds": 0.004 + }, + "lexical.land": { + "calls": 3, + "seconds": 0.072 + } + }, + "ledger_grew": 3, + "units_landed": 9 + } + ] + } + ] + }, + "pending": { + "before": { + "first_s": 7.4, + "warm_median_s": 2.243, + "warm_min_s": 2.203, + "warm_max_s": 2.264, + "pending": 0, + "load": [ + 2.27, + 2.54, + 2.75 + ] + }, + "after": { + "first_s": 5.788, + "warm_median_s": 2.333, + "warm_min_s": 2.331, + "warm_max_s": 2.335, + "pending": 0, + "load": [ + 3.33, + 3.39, + 3.32 + ] + } + }, + "sizes": { + "lexical_bytes_before": 4613689344, + "lexical_bytes_after": 4643323904, + "ledger_bytes_before": 313348096, + "ledger_bytes_after": 377790464 + }, + "migration": { + "note": "each the first open of a fresh clone by the branch's code, with the one-minute load read when its part or process began (in a landing process the ledger was opened after the lexical index, two minutes later)", + "opens": [ + { + "store": "lexical", + "where": "run 2, keyword part", + "open_s": 121.6, + "load_1min": 2.87 + }, + { + "store": "lexical", + "where": "run 2, landing process 0", + "open_s": 118.9, + "load_1min": 4.86 + }, + { + "store": "ledger", + "where": "run 2, landing process 0", + "open_s": 2.46, + "load_1min": 4.86 + }, + { + "store": "lexical", + "where": "run 2, landing process 1", + "open_s": 115.0, + "load_1min": 3.85 + }, + { + "store": "ledger", + "where": "run 2, landing process 1", + "open_s": 2.61, + "load_1min": 3.85 + }, + { + "store": "lexical", + "where": "run 2, landing process 2", + "open_s": 117.7, + "load_1min": 4.68 + }, + { + "store": "ledger", + "where": "run 2, landing process 2", + "open_s": 2.66, + "load_1min": 4.68 + }, + { + "store": "lexical", + "where": "run 2, single process 0", + "open_s": 120.3, + "load_1min": 3.44 + }, + { + "store": "ledger", + "where": "run 2, single process 0", + "open_s": 2.67, + "load_1min": 3.44 + }, + { + "store": "ledger", + "where": "run 2, ledger part", + "open_s": 2.07, + "load_1min": 4.85 + }, + { + "store": "lexical", + "where": "run 3, keyword part", + "open_s": 114.5, + "load_1min": 2.38 + }, + { + "store": "ledger", + "where": "run 3, ledger part", + "open_s": 1.82, + "load_1min": 2.65 + } + ] + }, + "note": "the record's first version: run 1 main at f969904e, run 2 the branch at 2bedbcf1, run 3 the keyword and ledger parts at f1a1f49c (the tree of b37d02e9); three warm passes a query; no prepared source, so the branch's parts ran on a file its first open had just read whole (the migration)" + }, + "landing_summary": { + "before": { + "new_batches_1_2": { + "n": 6, + "land_s_median": 10.446, + "land_s_range": [ + 9.414, + 11.501 + ], + "items_per_s_median": 191.5, + "land_many_s_median": 8.966, + "land_many_s_range": [ + 7.9788, + 10.0085 + ], + "upkeep_s_range": null, + "upkeep_s_median": null, + "upkeep_share_of_batch": null, + "appends_s_range": [ + 0.0499, + 0.0541 + ], + "producers_by_output_s_range": [ + 0.2994, + 0.4182 + ], + "units_landed_range": [ + 5438, + 7360 + ], + "load_1min_range": [ + 2.27, + 2.85 + ] + }, + "batch_0": { + "n": 3, + "land_s_median": 17.133, + "land_s_range": [ + 15.742, + 17.297 + ], + "items_per_s_median": 116.7, + "land_many_s_median": 15.094, + "land_many_s_range": [ + 13.7657, + 15.1643 + ], + "upkeep_s_range": null, + "upkeep_s_median": null, + "upkeep_share_of_batch": null, + "appends_s_range": [ + 0.0488, + 0.0557 + ], + "producers_by_output_s_range": [ + 0.682, + 0.7533 + ], + "units_landed_range": [ + 6443, + 7626 + ], + "load_1min_range": [ + 2.43, + 3.08 + ] + }, + "replace": { + "n": 3, + "land_s_median": 9.882, + "land_s_range": [ + 8.945, + 10.187 + ], + "items_per_s_median": 202.4, + "land_many_s_median": 8.293, + "land_many_s_range": [ + 7.4392, + 8.6584 + ], + "upkeep_s_range": null, + "upkeep_s_median": null, + "upkeep_share_of_batch": null, + "appends_s_range": [ + 0.0554, + 0.0592 + ], + "producers_by_output_s_range": [ + 0.3843, + 0.416 + ], + "units_landed_range": [ + 6584, + 7371 + ], + "load_1min_range": [ + 2.11, + 2.79 + ] + }, + "peak_rss_mb_range": [ + 373.6, + 379.6 + ], + "statistics_equal_a_count": [ + null, + null, + null + ] + }, + "after": { + "new_batches_1_2": { + "n": 6, + "land_s_median": 11.133, + "land_s_range": [ + 9.747, + 12.153 + ], + "items_per_s_median": 179.7, + "land_many_s_median": 9.776, + "land_many_s_range": [ + 8.3581, + 10.8597 + ], + "upkeep_s_range": [ + 0.3017, + 0.5295 + ], + "upkeep_s_median": 0.389, + "upkeep_share_of_batch": [ + 0.030953113778598548, + 0.04775432900432901 + ], + "appends_s_range": [ + 0.123, + 0.1408 + ], + "producers_by_output_s_range": [ + 0.0406, + 0.0875 + ], + "units_landed_range": [ + 5438, + 7360 + ], + "load_1min_range": [ + 2.73, + 3.82 + ] + }, + "batch_0": { + "n": 3, + "land_s_median": 18.256, + "land_s_range": [ + 16.869, + 19.021 + ], + "items_per_s_median": 109.6, + "land_many_s_median": 16.487, + "land_many_s_range": [ + 15.029, + 17.2733 + ], + "upkeep_s_range": [ + 0.3836, + 0.4394 + ], + "upkeep_s_median": 0.437, + "upkeep_share_of_batch": [ + 0.022739937162843085, + 0.02406879929886065 + ], + "appends_s_range": [ + 0.1663, + 0.1949 + ], + "producers_by_output_s_range": [ + 0.2143, + 0.2333 + ], + "units_landed_range": [ + 6443, + 7626 + ], + "load_1min_range": [ + 2.81, + 3.86 + ] + }, + "replace": { + "n": 3, + "land_s_median": 10.925, + "land_s_range": [ + 10.812, + 11.613 + ], + "items_per_s_median": 183.1, + "land_many_s_median": 9.632, + "land_many_s_range": [ + 9.5116, + 10.2952 + ], + "upkeep_s_range": [ + 0.7434, + 0.8526 + ], + "upkeep_s_median": 0.764, + "upkeep_share_of_batch": [ + 0.06875693673695893, + 0.07341772151898734 + ], + "appends_s_range": [ + 0.112, + 0.1164 + ], + "producers_by_output_s_range": [ + 0.0238, + 0.0283 + ], + "units_landed_range": [ + 6584, + 7371 + ], + "load_1min_range": [ + 3.25, + 3.82 + ] + }, + "peak_rss_mb_range": [ + 365.5, + 366.3 + ], + "statistics_equal_a_count": [ + true, + true, + true + ] + } + } +} \ No newline at end of file diff --git a/docs/experiments/keyword-and-ledger-2026-11-11.md b/docs/experiments/keyword-and-ledger-2026-11-11.md new file mode 100644 index 00000000..88b85a62 --- /dev/null +++ b/docs/experiments/keyword-and-ledger-2026-11-11.md @@ -0,0 +1,376 @@ +--- +type: experiment-report +experiment: keyword-and-ledger +runs: 5 +status: complete +started: 2026-11-11 +links: + - docs/experiments/keyword-and-ledger-2026-11-11.json # the numbers below, as data + - eval/stress_battery.py # the harness that produced every table + - docs/design-notes/dn-two-phase-ingestion.md # the lexical index (D1, D2, §7.1) + - docs/experiments/corpus-stage1-2026-11-07.md # the instance measured + - papers/2026-11-11-keyword-and-ledger/paper.tex # the article +--- + +# Keyword search and ledger lookups on the corpus instance, before and after (2026-11-11) + +**Question.** On the corpus instance at stage 1, a keyword query took seconds to tens of seconds +and the producers of one digest about two and a half seconds. Do kept per-class statistics with +one scoring statement, and a ledger table keyed by output hash, remove those costs, at what price +for a landing, and with exactly the answers the store gave before? Nothing here touched an +instance: every number is from copy-on-write clones of the corpus instance's data directory. + +## Method + +The harness is `eval/stress_battery.py`. It never opens the instance's files for writing. It +clones what it needs with `cp -c` into a scratch directory and first prepares a source of its +own: clones of the stores, the lexical index and the ledger opened once by the code under test, +which is where a store from before the change is migrated, once, timed with the load beside it. +Every part then clones the prepared files again, so each part of each code starts from files the +cache has not read, and a part that writes gets fresh clones a run. The source was the corpus +instance's data at stage 1: 400,274 items; 1,369,944 lexical units, every one current and +observed; 117,975,818 postings; 387,838 attestations, every one a `capture` naming one output +hash. + +Two runs, the same command and source: + +1. **before** (run 4), main at f969904e (the change's parent; its tree extracted with `git + archive`, its environment synced from the same lock file, this harness beside it), every part; +2. **after** (run 5), the branch at b61c0ca0, every part. The branch's later commits change code + on one path no run took: a migration that fails for a reason other than another connection's + lock is rolled back and the store answers as before the change, where at b61c0ca0 the open + and every query raised unless the file was read-only. + +Three earlier runs (1 to 3), with an earlier version of the harness, are at the end of this +record and in the JSON: they gave the same answers, and where their figures differ the reason is +stated there. + +The parts: + +- **keyword**: 16 title queries, ten from the query set of an earlier, unpublished study of the + stores (named L0 to L25 by their places in it) and six drawn independently (S0 to S5), from 1 + to 19 distinct terms and from 32 to 6,503,751 postings, named by their sizes and never by their + text. `search(text, k=10)` with the class filter the store always applies + (`classes=[observed]`) and with none; the store's call shape, `scores(text, + classes=[observed], paths=P)` and `search(..., paths=P)`, with P 400 random item paths, for + five queries. Warm: one process, the first pass reported apart, then five passes, each query's + median, every pass's wall time, processor time and load kept. Fresh process: three + repetitions, a new process each, for three queries. +- **ledger**: `producers_of`, and `already_attested` and `attested_by` through + `core/ingest/landing.py`, for five digests the ledger holds and two it does not, the first call + apart then five; `producers_by_output` and `attested_batch` for 2,000 held and 50 absent digests. +- **landing**: synthetic items through `Writer.land`, batched and lazy (the corpus runner's call), + in three fresh processes, each on fresh clones of the lexical store, the catalog, the ledger, + the versions and the vector directory: three batches of 2,000 new items, then a batch landing + the third batch's 2,000 paths again with other bytes, which replaces every unit that batch made + current. The statistics' upkeep (`LexicalStore._keep`) is timed on its own where the code has + one, and the kept class statistics are checked against a count after the four batches. A + synthetic item is a real corpus item (a seeded draw) with one first line naming the run and the + item: a new digest, a real item's text, chunks and terms. **single**: three items effect by + effect (`batch=False`), the path of every lane but the corpus runner's. +- **pending**: `derive.pending` over the clones, the first call apart then five. No line of the + change reads it: it is the control for the machine between the runs. +- **concurrent**: a lexical file from before the change (the source's own, not the prepared one) + opened by one process and, 5 s later, by a second that asks one query (L0, class filter): what a + reader meets while the first open migrates the file. +- **not run**, each named in the JSON with its reason: the whole-stratum load of a sentence + admitting the dialogue stratum (tens of gigabytes on the whole corpus; the stage-1 record has + 4.3 to 4.7 GB at 10,000 items); the test that a commit's cut holds a citation edge (the corpus + instance has no citation store); and the pending mask of a sentence's nodes (empty when nothing + is pending, and `derive.pending` finds 0 items here). + +Conditions: Apple M2 Pro, 12 cores, 32 GB, shared with other work. The one-minute load average is +read beside every timing (the ranges below are of that field), BLAS is capped at four threads, +and every process ends itself above 3.8 GB resident. Python 3.15.2, SQLite 3.54.1. The corpus's +lexical file predates the store's record of its tokenizer, so every run opens it with LEGACY's, +which made it; under the current tokenizer the store refuses it until it is re-derived. + +## Results + +Every answer the battery took before the change is the answer it took after it, scores compared +as the bits of their doubles: the 65 it keeps (the four keyword shapes' top tens with their +scores and the path scores, 42; the producer sets and lists, 23), the 18 fresh processes' +answers, which equal the warm ones, and the concurrent part's answer. The three earlier runs gave +the same 65. + +### Keyword search + +| shape (warm medians) | before | after | load, before / after | +|---|---|---|---| +| title query, class filter, median of 16 (min-max) | 14.4 s (1.49-34.1 s) | 1.20 s (0.08 ms-6.17 s) | 3.0-5.6 / 2.7-3.8 | +| title query, no filter, median of 16 | 9.58 s (0.97-23.3 s) | 1.16 s (0.07 ms-5.78 s) | 2.2-5.0 / 2.7-3.7 | +| the store's shape, `scores`, 400 paths, median of 5 | 5.41 s (1.19-15.1 s) | 5.9 ms (1.9-12.4 ms) | 2.2-3.0 / 2.8 | +| the store's shape, `search`, 400 paths, median of 5 | 5.39 s (1.20-15.0 s) | 4.7 ms (1.8-11.5 ms) | 1.9-2.6 / 2.8 | + +Per query (each query's warm median in seconds, the before columns with the range of their five +passes; the path shapes' after columns in milliseconds): + +| query | terms | postings | class filter, before | after | no filter, before | after | `scores` with paths, before | after (ms) | `search` with paths, before | after (ms) | +|---|---|---|---|---|---|---|---|---|---|---| +| L0 | 1 | 108 | 1.50 (1.49-1.52) | 0.0001 | 0.969 (0.966-0.986) | 0.0001 | 1.19 (1.18-1.22) | 1.9 | 1.20 (1.20-1.21) | 1.8 | +| L3 | 2 | 26,949 | 2.92 (2.91-2.93) | 0.0223 | 1.85 (1.81-1.86) | 0.0221 | | | | | +| L6 | 2 | 191,032 | 3.36 (3.34-3.38) | 0.165 | 2.12 (2.11-2.16) | 0.169 | 2.25 (2.24-2.29) | 3.2 | 2.25 (2.24-2.26) | 2.7 | +| L8 | 10 | 498,437 | 15.1 (15.1-15.2) | 0.631 | 9.94 (9.54-10.1) | 0.608 | | | | | +| L11 | 5 | 1,337,195 | 9.54 (9.23-9.71) | 1.04 | 6.30 (6.22-6.58) | 0.994 | 5.41 (5.39-5.43) | 5.9 | 5.39 (5.37-5.43) | 4.7 | +| L14 | 10 | 1,860,446 | 17.5 (17.4-17.5) | 1.84 | 11.4 (11.3-11.4) | 1.77 | | | | | +| L17 | 7 | 2,671,741 | 13.7 (13.4-13.9) | 2.08 | 9.52 (9.49-9.57) | 1.99 | 7.61 (7.59-7.61) | 7.7 | 7.61 (7.60-7.71) | 6.7 | +| L20 | 9 | 3,801,316 | 26.1 (17.9-33.1) | 2.89 | 12.1 (12.1-12.1) | 2.77 | | | | | +| L23 | 14 | 4,966,503 | 32.3 (30.0-38.6) | 4.22 | 17.3 (17.3-17.3) | 4.02 | 15.1 (15.0-15.1) | 12.4 | 15.0 (15.0-15.1) | 11.5 | +| L25 | 19 | 6,503,751 | 34.1 (33.9-34.4) | 6.17 | 23.3 (23.2-23.7) | 5.78 | | | | | +| S0 | 1 | 32 | 1.49 (1.45-1.50) | 0.0001 | 0.990 (0.985-0.999) | 0.0001 | | | | | +| S1 | 3 | 1,224,831 | 6.37 (6.34-6.41) | 0.880 | 4.55 (4.52-4.62) | 0.789 | | | | | +| S2 | 4 | 890,406 | 7.14 (7.07-7.21) | 0.707 | 4.81 (4.78-4.82) | 0.669 | | | | | +| S3 | 9 | 1,378,417 | 15.2 (15.0-15.5) | 1.37 | 9.65 (9.63-9.65) | 1.33 | | | | | +| S4 | 12 | 3,283,060 | 20.8 (20.5-26.0) | 2.95 | 14.3 (14.2-14.3) | 2.79 | | | | | +| S5 | 17 | 3,338,954 | 27.8 (27.6-28.7) | 3.49 | 18.6 (18.6-18.7) | 3.42 | | | | | + +The fresh process, three repetitions a query (class filter, then the store's `scores` shape): + +| query | before | after | peak resident, before / after | +|---|---|---|---| +| L0, class filter | 1.41-1.43 s | 0.50-0.53 ms | 70-71 / 68 MB | +| L11, class filter | 8.77-8.85 s | 0.95-0.96 s | 447-448 / 72-73 MB | +| L23, class filter | 24.0-24.2 s | 4.03-4.04 s | 468-469 / 73 MB | +| L0, `scores` with 400 paths | 1.19-1.21 s | 2.8-3.0 ms | 70-72 / 70-71 MB | +| L11, `scores` with 400 paths | 5.40-5.42 s | 6.9-7.2 ms | 71 / 71 MB | +| L23, `scores` with 400 paths | 15.0-15.1 s | 14.1-14.3 ms | 71 / 71 MB | + +A single pass can stray from its query's median, and the load average does not show when. Of the +before run's 210 warm passes of 0.1 s or more, two took 1.2 times their query's median or more (at +most 1.27 times), and ten took 1.1 to 1.75 times their own processor time, every one under the +class filter (L20, L23 and S4) at one-minute loads of 3.1 to 5.6: those passes waited. The medians +of L20 and L23 under the class filter (26.1 s and 32.3 s) carry the waits; the medians of their +processor times are 18.9 s and 26.8 s. The after run's 130 passes of 0.1 s or more were all within +1.08 times their medians, and none waited. + +A free query still reads every posting of its terms: its time follows them, under 1 µs a posting +(6.17 s for L25's 6.5 million under the class filter), and the cost of a term no longer depends on +the units it is not in. The memory of a free query fell with the Python dictionary of every scored +unit, which the statement no longer builds; the paths shape's memory did not move. + +### The ledger + +| lookup (warm medians) | before | after | +|---|---|---| +| `producers_of`, one digest (7 digests, 2 absent) | 2.43 s | 8.2 µs (first calls 0.27-0.55 ms) | +| `already_attested` through the landing | 2.40 s | 8.5 µs | +| `attested_by` through the landing | 2.42 s | 8.1 µs | +| `producers_by_output`, 2,050 digests | 292 ms | 6.4 ms (first call 295 ms) | +| `attested_batch`, 2,050 digests | 290 ms | 6.5 ms | + +Load 1.9-3.6 before, 2.9 after. The first calls after the change read the table from a file the +cache had not read: a digest's first seek took 0.27 to 0.55 ms, and the first batch 295 ms, as +long as the pass over the records it replaced; from the second call the batch takes 6.4 ms. + +### The landing + +| three processes, each 3 batches of 2,000 new items, then 1 replacing the third's | before | after | +|---|---|---| +| batches 1 and 2, seconds, median (min-max) | 10.45 (9.41-11.50) | 11.13 (9.75-12.15) | +| items a second, batches 1 and 2, median | 192 | 180 | +| the lexical stage (`land_many`), batches 1 and 2 | 8.97 s (7.98-10.01) | 9.78 s (8.36-10.86) | +| the upkeep (`_keep`), batches 1 and 2 | | 0.39 s (0.30-0.53), 3.1-4.8% of the batch | +| the replacing batch, seconds, median (min-max) | 9.88 (8.95-10.19) | 10.93 (10.81-11.61) | +| its lexical stage | 8.29 s (7.44-8.66) | 9.63 s (9.51-10.30) | +| its upkeep | | 0.76 s (0.74-0.85), 6.9-7.3% of the batch | +| batch 0, seconds, median (min-max) | 17.13 (15.74-17.30) | 18.26 (16.87-19.02) | +| the ledger's lookup for a batch (`producers_by_output`) | 0.30-0.42 s (batch 0: 0.68-0.75 s) | 24-88 ms (batch 0: 0.21-0.23 s) | +| a batch's 2,000 appends | 0.050-0.059 s | 0.11-0.14 s (batch 0: 0.17-0.19 s) | +| kept class statistics against a count after the four batches | | equal in 3 of 3 processes | +| peak resident | 374-380 MB | 366 MB | +| load | 2.1-3.1 | 2.7-3.9 | +| three items effect by effect | 22.8 s (7.6 s an item) | 0.48 s (0.16 s an item) | + +The units landed are the same in both runs, batch for batch (5,438 to 7,626 a batch of new items; +a replacing batch writes 6,584 to 7,371 and moves the currency of twice as many). The landing +costs more after the change: a batch of new items 0.69 s at the median (7%), a replacing batch +1.04 s (11%), batch 0 1.12 s (7%), at a one-minute load 0.5 to 1 higher. Item for item (the same +items in the same process number on each code), the lexical stage rose 0.4 to 1.3 s for five of +the six batches of new items and fell 0.9 s for the sixth, and rose 1.3 to 2.1 s for the three +replacing batches. The upkeep, timed on its own, is 0.30 to 0.53 s a batch of new items and 0.74 +to 0.85 s a replacing batch, which moves the statistics for the units it supersedes as well as +for those it makes current; the trigger's rows add 28 to 43 µs an append (56 to 73 µs in a +process's first batch, the table not yet read); the ledger's lookup saves 0.23 to 0.52 s a batch. +The rest of the lexical stage's rise is not attributed: the upkeep's timer covers its statements, +not the commit that writes the pages they changed, and the after run met the higher load. Effect +by effect, the nine passes over the ledger were 99.4% of the time (22.7 s); after the change the +ledger's lookups take 2 ms of the 0.48 s, on files the cache had not read. + +### The control + +`derive.pending`, untouched by the change, took 2.19 s warm before (2.17-2.21) and 2.22 s after +(2.15-2.31), and 7.54 s and 7.47 s at its first call, each on a clone of the prepared files the +cache had not read (after the change the prepared file was migrated already, so the part's open +read nothing). The two runs met the same machine within 2%, at one-minute loads of 2.1 to 2.3 +before and 3.6 to 3.8 after. + +### The migrations + +A store from before the change migrates on its first open, once. Counting the lexical statistics +of the 1,369,944 units took 126.0 s in run 5's prepare step (a clone the cache had not read, +one-minute load 2.0) and added 29.6 MB to the 4.61 GB file (`term_stats`, 1,053,985 rows); the +concurrent part's first open counted them in 119.3 s (load 3.8). The ledger's table took 2.68 s +(load 3.0) and added 64.4 MB to the 313 MB file, 166 B a record. The earlier runs' migrations +are below, with their loads. + +### A reader while the first open migrates + +| the concurrent part | before | after | +|---|---|---| +| the first process's open | 1.1 ms (nothing to migrate) | 119.3 s (the count) | +| the second process's open, 5 s later | 0.66 ms | 0.47 ms | +| its query (L0, class filter) | 16.7 s | 1.37 s | +| one-minute load | 2.3-2.5 | 3.7-3.8 | + +After the change the second process opened at once while the first held the write lock, counted +its query's statistics from the units (the store had none counted yet), and answered as the code +before did: the same answer as the keyword part's, in 1.37 s, while the first process's count was +reading the file. Before the change the same query met a file nobody was reading and took 16.7 s. +The first open or query that finds the lock free and the statistics not counted counts them, in +that call, which on the corpus takes the two minutes above. A writer that opens the store during +the count waits for the write lock, as any write does, up to the store's 30 s timeout, and fails +after it (not measured here). + +### The filtered aggregate against `CASE` + +The statement's per-term aggregate, `max(r.c) FILTER (WHERE r.i = j)`, against the form it +replaced, `max(CASE WHEN r.i = j THEN r.c END)`, the statement otherwise the same: one process on +one clone of run 5's migrated file, the 14 queries of two terms or more under the class filter, +five rounds, the order of the two forms alternating by round and query, after one pass a query to +read the file. Medians of the five rounds, at one-minute loads of 2.7 to 4.3: + +| query | terms | `CASE` | `FILTER` | faster | +|---|---|---|---|---| +| L3 | 2 | 24.8 ms | 22.7 ms | 8.6% | +| L6 | 2 | 0.185 s | 0.170 s | 8.4% | +| S1 | 3 | 0.985 s | 0.824 s | 16.3% | +| S2 | 4 | 0.878 s | 0.694 s | 20.9% | +| L11 | 5 | 1.36 s | 1.02 s | 25.0% | +| L17 | 7 | 2.54 s | 2.06 s | 18.7% | +| L20 | 9 | 3.49 s | 2.89 s | 17.0% | +| S3 | 9 | 1.85 s | 1.35 s | 27.0% | +| L8 | 10 | 0.846 s | 0.611 s | 27.9% | +| L14 | 10 | 2.49 s | 1.80 s | 27.7% | +| S4 | 12 | 3.68 s | 2.85 s | 22.6% | +| L23 | 14 | 5.24 s | 4.16 s | 20.6% | +| S5 | 17 | 4.73 s | 3.46 s | 26.7% | +| L25 | 19 | 7.51 s | 5.89 s | 21.6% | + +The answers of the two forms are identical. The filtered form is 17 to 28% faster on the nine +titles of seven terms or more, 16 to 25% on those of three to five, and 8 to 9% on the two of two +terms. + +## What the code showed + +- SQLite 3.54.1's `sum()` and `total()` compensate their rounding, so a sum they take over the + same values in the same order is not the store's left-to-right sum (1 + 2^-53 + 2^-53 gives + 1 + 2^-52 against 1). The statement writes the sum out in the terms' order, each term the unit + lacks adding 0.0, which leaves a positive double as it is; with that the scores are identical, + where a statement that sums with `sum()` is not. +- Without planner statistics, the paths shape was driven from the class's index and visited every + current unit of the class for each path; the statement names `units_path`. +- SQLite parses `a + b + ...` as a tree as deep as its terms and refuses a depth over 1,000, so + the written-out sum stops at 500 terms; a longer query's weights are read out of the statement + in the terms' order and summed in Python. +- The statement replaced in `producers_by_output` filled a temporary table, which in the ledger's + transaction mode opened a transaction that kept a shared lock on the ledger file (rollback + journal mode) after the call; the lookups now only read. +- An attestation sorts its output hashes and does not remove repeats, so the side table keeps one + row for each element (its position in the key), and `producers_by_output` lists a record once + for each time it names a hash, as before. +- Kept by row triggers instead of in the landing's transaction, the statistics would need one + upsert a posting of each unit whose currency moves (86 a unit on average here) rather than one + a distinct (term, class) pair of the batch; the upkeep is batched in the transaction, and only + the guard is a trigger. +- A migration that waits for the write lock makes every other process that opens the store during + the count wait out the busy timeout and fail, readers included. The first version of this change + did, and its record did not say so. The count now does not wait; a reader opens at once and + counts its query's statistics from the units until the count is done. +- A migration is a write that an open and a query make, where main's open writes nothing, so no + failure of it may stop a reader. At b61c0ca0 only the lock and a read-only file were caught: a + full file made the open and every query raise (the tests that now hold this set SQLite's page + limit at the file's size, and fail at b61c0ca0). Every failure is now rolled back, and the + store answers from its units, the ledger from its records, until a later query finds the lock + free or, for any other failure, until it is opened again. +- In main's code `search` and `scores` with paths run the same computation (`_score_units` over + the paths' units) and differ only by a sort of the scored units or a map to their paths, so + their before times are the same work. + +## Caveats + +- One run before and one after on a machine shared with other work, and three earlier runs with + an earlier harness; read the load beside each figure. A pass can wait at an ordinary load, which + the load average does not show: the figures are medians of five passes, and the JSON keeps every + pass with its processor time. +- The landing's after run met a one-minute load 0.5 to 1 higher than its before run, and part of + the lexical stage's rise is not attributed. +- The corpus holds one class, so the clearance rule's sums are over one row here; the generated + stores of the property tests hold four. +- Every part starts on files the cache has not read, and the figures are warm medians beside each + part's first call; a file larger than memory was not measured. +- The corpus's lexical file is LEGACY's; the current tokenizer re-derives it before it scores it, + and that re-derivation lands every unit again (with its statistics). +- Not run: the whole-stratum load of a sentence admitting the dialogue stratum, the cut test of a + citation sentence and the pending mask (each with its reason above). + +## The earlier runs (1 to 3) + +The first version of this record rested on three runs of an earlier version of the battery: three +warm passes a query, no processor time, and no prepared source, so the branch's parts ran on a +lexical file that its first open had just read whole while it counted the statistics. + +1. main at f969904e, every part; +2. the branch at 2bedbcf1, every part; +3. the branch at f1a1f49c (the tree of b37d02e9, made again when the subject of an earlier commit + was reworded), the keyword and ledger parts again. Between runs 2 and 3 the sum's per-term + aggregates became filtered, and the ledger's lookups stopped sorting the hashes they are asked + for. + +The five runs gave the same 65 answers. The JSON keeps the earlier runs' figures under +`earlier_runs`. What did not hold, or was stated wrongly: + +- Run 1's `search` with paths took a median of 8.43 s (2.33 to 15.7 s) over the five queries and + its `scores` with paths 5.47 s. In main's code the two are the same computation, and run 4 gives + 5.39 s and 5.41 s. Run 1's passes of the `search` shape spread widely at one-minute loads of 3.1 + to 4.2: L0 1.25 to 3.59 s, L11 6.32 to 12.56 s, L17 14.9 to 17.8 s after a first call of 7.71 s. + Run 4's passes of the same queries stay within 2% of their medians. Run 1 kept no processor + time, so whether its slow passes waited cannot be told. +- Run 1's class-filtered L3 took 5.55 to 5.86 s in each of its four calls; run 4's took 2.91 to + 2.93 s. +- Run 2's landing met files its first open had just read; the upkeep was not timed and no batch + replaced versions. Its record put the upkeep within the spread of the lexical stage (9.38 s + against 8.83 s for batches 1 and 2, at a load one to four higher) and called a batched landing + unchanged within its spread. Runs 4 and 5 time the upkeep and find the landing slower (above). +- The record said the landing, the single landing and the control exercised no line changed + between runs 2 and 3, so their after figures were run 2's. They reach one: the ledger's lookups + no longer sort the hashes they are asked for. The answers cannot change (the lookups return sets + and sorted lists), and the sort it dropped takes 0.24 ms for 2,050 hashes. +- Run 2's control took its first call (5.79 s) on a file the migration had just read, not on a + cold one. The record also set run 1's first call (7.40 s) beside a 7.2 s it attributed to the + stage-1 record, which holds no time for the pending set; that comparison is dropped. +- Load ranges the record labelled one-minute were not all one-minute. Run 3's ledger part ran at a + one-minute load of 2.65 (the record gave 2.5 to 3.7, the five- and fifteen-minute fields mixed + in); the pending set's one-minute loads were 2.3 to 2.6 before and 3.2 to 3.4 after, and the + single landing's 2.4 and 3.3 to 3.4 (the record gave the spread of one reading's three fields). + Run 3's class-filtered pass met a one-minute load of 6.0 to 11.3 for its second half (L17 to + S5); the record gave 6.7, the lowest first reading. +- The record gave the ledger lookups the first call apart then five passes; they had three. +- The record and the article gave the filtered aggregate as 6 to 27% faster than the `CASE` form + on the long titles. No run recorded that figure; the interleaved comparison above is the + measurement. +- The six lexical migrations of runs 2 and 3 took 114.5 to 121.6 s at one-minute loads of 2.38 to + 4.86, the ledger's six 1.82 to 2.67 s at 2.65 to 4.86 (the loads read when each part or process + began; the JSON has each). + +## Reproduce + + uv run python -m eval.stress_battery --source \ + --scratch --out --queries \ + --tokenizer legacy --passes 5 --fresh 3 --fresh-qids L0,L11,L23 \ + --path-qids L0,L6,L11,L17,L23 --runs 3 + +`` is a JSON list of `{"qid", "text"}`; without it the battery draws titles from the +store. The before run used main's tree at f969904e with this harness beside it. The comparison of +the two aggregates is a scratch script, not committed: on one clone of the migrated file it +rewrites the statement's aggregates on the store's connection and alternates the two forms by +round and query. diff --git a/docs/runbook.md b/docs/runbook.md index 23d579be..9dcfc97c 100644 --- a/docs/runbook.md +++ b/docs/runbook.md @@ -919,6 +919,45 @@ means restart** — a true stop is `launchctl bootout gui/$(id -u)/com.mind-pala Rollback = `git revert` + `deploy` again; the run ledger keeps every stretch pinned to its commit, so "what was live when" is always answerable. +### Reverting the kept lexical statistics (2026-11-11) + +A revert does not take back what that change wrote into an instance's stores. Once a lexical +index's statistics are counted, three triggers on its units (`units_kept_insert`, +`units_kept_update`, `units_kept_delete`) refuse every write from code that does not keep the +statistics, so the reverted code's landings, retires and resets raise. Drop them, and the record +that the statistics are counted, in each instance's `lexical.sqlite` (beside its other stores), +once the revert is deployed and no process of the code being reverted is left: + +```sh +sqlite3 /lexical.sqlite "DROP TRIGGER IF EXISTS units_kept_insert; + DROP TRIGGER IF EXISTS units_kept_update; DROP TRIGGER IF EXISTS units_kept_delete; + DELETE FROM meta WHERE key = 'statistics';" +``` + +The code being reverted counts the statistics again, and installs the triggers with them, +whenever an open or a query finds the record gone, and a process keeps the code it started with. +The deploy restarts the daemon on the reverted code and no other process, so before the step end +every process that opens an instance's stores and started before the deploy, or runs from a +checkout or worktree that still holds the change: the Ambassador's MCP server +(`scripts/palace_mcp.py`, spawned and kept running by its harness), the Open WebUI bridge's +responder, a `mind-palace query`, `mind-palace embed`, the corpus runner. +`lsof /lexical.sqlite` lists the processes that hold the file open, and +`ps -o lstart= -p ` when each started; a process that has not opened the file yet is not +listed. After the step, and again a while later, this prints nothing while the triggers stay +dropped: + +```sh +sqlite3 /lexical.sqlite \ + "SELECT name FROM sqlite_master WHERE type = 'trigger' AND name GLOB 'units_kept_*'" +``` + +If it prints them, a process of the change opened or queried the store after the step and counted +the statistics again: end it, and run the step again. The reverted code reads neither +`class_stats` nor `term_stats`; deleting the record makes the change, if it lands again, count +them anew rather than trust tables the reverted code did not keep. The ledger needs nothing: its +`output_hashes` table and the trigger that fills it stay, and the trigger keeps the table on every +append, whoever appends. + ## CI witness — attested remote verdicts for the deploy gate (owner-operated) `ops/ci_witness.py` (CLI: `uv run scripts/ci_witness.py check ` · `rotate`) diff --git a/eval/stress_battery.py b/eval/stress_battery.py new file mode 100644 index 00000000..d3e8b58f --- /dev/null +++ b/eval/stress_battery.py @@ -0,0 +1,819 @@ +"""The stores under load: a fixed battery run against a copy-on-write clone of an instance's +stores, so a change to a hot path is measured before and after on the same data. + + uv run python -m eval.stress_battery --source DIR --scratch DIR --out FILE + [--parts keyword,ledger,landing,single,pending,concurrent,stratum,cut,mask] + [--queries FILE] [--tokenizer legacy|current] [--passes 3] [--fresh 3] [--paths 400] + [--runs 3] + +`--source` is an instance's data directory (`lexical.sqlite`, `attestations.sqlite`, +`vault_catalog.sqlite`, `versions.sqlite`, `vectors.lance/`, `raw/`). It is never opened for +writing: the battery clones the files it needs into `--scratch` with `cp -c` (on APFS a clone +takes no space until it is written) and opens the clones. First it prepares a source of its own: +clones of the stores, the lexical index and the ledger opened once by the code under test, so a +store from before a change is migrated there, once, timed with the load beside it. Every part +then clones the prepared files again, so each part of each code starts from files the cache has +not read, and a part that writes gets fresh clones a run. The battery is the places an earlier +scaling study of the stores (unpublished) found past budget, measured where it is safe to: + +- `keyword`: `LexicalStore.search` over a set of title queries, with the class filter the palace + passes and with none, and the palace's own call shape, a class and a list of `--paths` item + paths (`scores` and `search`, as `core/sentence/universe.py` calls them); warm (one process, the + first pass apart, then `--passes`, each pass's time and load kept) and in a fresh process a + query (`--fresh` repetitions); +- `ledger`: the producers of single digests (`producers_of`, and `already_attested` and + `attested_by` through `core/ingest/landing.py`) and of a batch of 2,050 (`producers_by_output`, + `attested_batch`); +- `landing`: synthetic items through the palace's writer (`Writer.land`, batched and lazy, the + corpus runner's call), in `--runs` fresh processes: three batches of 2,000 new items, then a + batch landing the third batch's 2,000 paths again with other bytes, which replaces every unit + that batch made current; items a second, the time of each stage and store call, and the + lexical index's upkeep of its statistics (`LexicalStore._keep`) where the code has one; + `single`: three items effect by effect (`batch=False`), the path of every lane but the corpus + runner's; +- `pending`: `derive.pending`, the drain's pending set, which a lazy instance's sentences read; +- `concurrent`: a lexical index from before the change (the source's own, not the prepared one) + opened by one process and, `--concurrent-delay` seconds later, by a second that asks one + query, as a reader opens the index while the first open migrates it; +- not run, each named in the record with its reason: `stratum`, the whole-stratum load of a + sentence admitting the dialogue stratum (tens of gigabytes on a whole corpus); `cut`, the test + that a commit's cut holds a citation edge (an instance with no citation store has none to read); + `mask`, the pending mask of a sentence's nodes (empty on an instance with nothing pending). + +A synthetic item is a real item of the instance made new: its bytes with one first line naming the +run and the item, so its digest is new while its text, chunks and terms stay a real item's. Every +timing carries the load average read beside it; every process caps BLAS at four threads and ends +itself past `--max-rss-gb` of resident memory (a thread polls its peak). A query's text and an +item's content never reach the record: a query is named by its id, its count of distinct terms +and its postings, an answer by a digest of it (the answers themselves go to `.answers.json` +beside the record, to compare two runs bit for bit). +""" + +from __future__ import annotations + +import os + + +def _cap_threads(value: str | None, cap: int = 4) -> str: + """At most `cap` threads: a smaller count given stays, a larger one or none becomes `cap`.""" + try: + n = int(value) if value is not None else cap + except ValueError: + n = cap + return str(min(n, cap) if n >= 1 else cap) + + +for _var in ("OMP_NUM_THREADS", "OPENBLAS_NUM_THREADS", "MKL_NUM_THREADS", + "VECLIB_MAXIMUM_THREADS", "NUMEXPR_NUM_THREADS"): + os.environ[_var] = _cap_threads(os.environ.get(_var)) + +import argparse # noqa: E402 +import hashlib # noqa: E402 +import json # noqa: E402 +import platform # noqa: E402 +import random # noqa: E402 +import resource # noqa: E402 +import shutil # noqa: E402 +import sqlite3 # noqa: E402 +import statistics # noqa: E402 +import subprocess # noqa: E402 +import sys # noqa: E402 +import threading # noqa: E402 +import time # noqa: E402 +from collections import defaultdict # noqa: E402 +from collections.abc import Callable, Sequence # noqa: E402 +from datetime import UTC, datetime # noqa: E402 +from functools import partial # noqa: E402 +from pathlib import Path # noqa: E402 +from typing import Any # noqa: E402 + +ROOT = Path(__file__).resolve().parent.parent +sys.path.insert(0, str(ROOT)) + +PARTS = ("keyword", "ledger", "landing", "single", "pending", "concurrent", "stratum", "cut", + "mask") +STORES = ("lexical.sqlite", "attestations.sqlite", "vault_catalog.sqlite", "versions.sqlite", + "vectors.lance") +ITEMS = 2000 # a batch, the corpus runner's (`[ingestion.corpus] batch`) +NEW_BATCHES = 3 # batches of new items a landing process; then one that replaces +ABSENT = 50 # digests the ledger never saw, added to the batch +CORPUS_OVERLAY = "config/instances/corpus.toml" +NOT_RUN = { + "stratum": ("not run: a sentence admitting the dialogue stratum loads every row of it with " + "its vector (`all_rows(DIALOGUE_READ)`, core/sentence/universe.py) and builds " + "dense n by n matrices over the items; the corpus instance's stage-1 record " + "(docs/experiments/corpus-stage1-2026-11-07.md) has 4.3 to 4.7 GB at 10,000 " + "items, and the whole corpus would need tens of GB. It belongs to a bounded " + "universe, not to this battery"), + "cut": ("not run: the test that a commit's cut holds a citation edge reads every edge of the " + "commit (`ReferenceEdgeStore.for_commit`, from core/sentence/universe.py); it needs " + "a citation store, and an instance without one, as the corpus instance is, has no " + "edge for it to read"), + "mask": ("not run: the pending mask of a sentence's nodes (core/sentence/universe.py) " + "builds the set of pending items again for each node; it is empty when nothing is " + "pending, as on the corpus instance, where `derive.pending` finds 0 items"), +} + + +# ── conditions: load, memory, clones ─────────────────────────────────────────────────────────── + +def load() -> list[float]: + return [round(x, 2) for x in os.getloadavg()] + + +def peak_rss_mb() -> float: + """This process's peak resident set (ru_maxrss: bytes on macOS, kilobytes on Linux).""" + peak = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss + return round(peak / 1e6 if sys.platform == "darwin" else peak / 1e3, 1) + + +def guard(max_rss_gb: float) -> None: + """End the process (exit 75) once its peak resident set passes the cap.""" + cap = max_rss_gb * 1e3 + + def watch() -> None: + while True: + if peak_rss_mb() > cap: + sys.stderr.write(f"stress_battery: resident set past {max_rss_gb} GB; ending\n") + sys.stderr.flush() + os._exit(75) + time.sleep(0.02) + threading.Thread(target=watch, daemon=True).start() + + +def clone(src: Path, dst: Path) -> None: + """A copy-on-write clone of a file or a directory (`cp -c` on APFS, a reflink elsewhere when + the filesystem has one); the SQLite companions of a file come with it.""" + dst.parent.mkdir(parents=True, exist_ok=True) + flag = ["-c"] if sys.platform == "darwin" else ["--reflink=auto"] + if src.is_dir(): + subprocess.run(["cp", *flag, "-R", str(src), str(dst)], check=True) + return + for suffix in ("", "-wal", "-shm"): + s = Path(str(src) + suffix) + if s.exists(): + subprocess.run(["cp", *flag, str(s), str(dst) + suffix], check=True) + + +def fresh_dir(path: Path) -> Path: + if path.exists(): + shutil.rmtree(path) + path.mkdir(parents=True) + return path + + +def size(path: Path) -> int: + """A store's bytes: the file with its write-ahead log.""" + return sum(Path(str(path) + s).stat().st_size for s in ("", "-wal") + if Path(str(path) + s).exists()) + + +def prepare(a: argparse.Namespace, scratch: Path) -> tuple[Path, dict[str, Any]]: + """The battery's own source: clones of the source's stores, the lexical index and the ledger + opened once by the code under test and closed, so a store from before a change is migrated + here, once, and timed (a code with nothing to migrate opens it at once). The raw objects are + read in the source, never written.""" + from core.attestation import AttestationStore + from core.stores.lexical import LexicalStore + + d = fresh_dir(scratch / "source") + for name in STORES: + if (a.source / name).exists(): + clone(a.source / name, d / name) + out: dict[str, Any] = {} + openers: dict[str, Callable[[Path], Any]] = { + "lexical.sqlite": lambda p: LexicalStore(p, tokenizer=tokenizer(a.tokenizer)), + "attestations.sqlite": AttestationStore} + for name, opener in openers.items(): + path = d / name + if not path.exists(): + continue + before = size(path) + t, ld, store = timed(partial(opener, path)) + # migrated: the statistics counted, or the ledger's output-hash table present + migrated = bool(store._conn.execute( + "SELECT 1 FROM meta WHERE key = 'statistics'" if name == "lexical.sqlite" else + "SELECT 1 FROM sqlite_master WHERE name = 'output_hashes'").fetchone()) + store.close() + out[name] = {"open_s": t, "load": ld, "load_end": load(), "bytes_before": before, + "bytes_after": size(path), "migrated": migrated} + print(f"prepare {name}: open {t:.2f}s load {ld} migrated {migrated}", flush=True) + return d, out + + +def digest(obj: Any) -> str: + return hashlib.sha256(json.dumps(obj, sort_keys=True).encode()).hexdigest()[:16] + + +def summary(times: Sequence[float]) -> dict[str, Any]: + s = sorted(times) + return {"n": len(s), "median_s": statistics.median(s), "min_s": s[0], "max_s": s[-1]} + + +def timed[T](fn: Callable[[], T]) -> tuple[float, list[float], T]: + ld = load() + t0 = time.perf_counter() + value = fn() + return time.perf_counter() - t0, ld, value + + +def repeat(fn: Callable[[], Any], passes: int) -> dict[str, Any]: + """The first call apart (a fresh process's first, the file cache as it is), then `passes` + warm calls; the answers must not change between calls. Each call's processor time is kept + beside its wall time: a slow pass whose processor time is as long was slow on the processor, + not waiting.""" + c0 = time.process_time() + first, ld, value = timed(fn) + cpu = [time.process_time() - c0] + warm, loads, stable = [], [ld], True + for _ in range(passes): + c0 = time.process_time() + dt, ld, again = timed(fn) + cpu.append(time.process_time() - c0) + warm.append(dt) + loads.append(ld) + stable &= again == value + return {"first_s": first, "warm": summary(warm) if warm else None, "warm_s": warm, + "cpu_s": cpu, "load": loads, "stable": stable, "answer": value} + + +def tokenizer(name: str) -> Any: + from core.ingest.lexical import LEGACY, TOKENIZER + + return {"legacy": LEGACY, "current": TOKENIZER}[name] + + +def code_label() -> dict[str, Any]: + """Which code ran: the checkout's commit when it is one, else the name given.""" + try: + sha = subprocess.run(["git", "-C", str(ROOT), "rev-parse", "HEAD"], capture_output=True, + text=True, check=True).stdout.strip() + except (OSError, subprocess.CalledProcessError): + sha = "" + return {"git": sha, "label": os.environ.get("STRESS_CODE_LABEL", "")} + + +def child(args: list[str], max_rss_gb: float) -> dict[str, Any]: + """Run one measurement in a fresh process of this module; its last line is its record.""" + env = {**os.environ, "PYTHONDONTWRITEBYTECODE": "1"} + proc = subprocess.run([sys.executable, "-m", "eval.stress_battery", "child", *args, + "--max-rss-gb", str(max_rss_gb)], cwd=ROOT, env=env, + capture_output=True, text=True) + if proc.returncode != 0: + return {"error": f"exit {proc.returncode}", "stderr": proc.stderr[-2000:]} + return dict(json.loads(proc.stdout.strip().splitlines()[-1])) + + +# ── keyword search ───────────────────────────────────────────────────────────────────────────── + +def pick_queries(store: Any, n: int, seed: int) -> list[dict[str, Any]]: + """Titles of random units (seeded), distinct: the battery's queries when none are given.""" + conn = store._conn + hi = int(conn.execute("SELECT max(unit_id) FROM units").fetchone()[0] or 0) + rng = random.Random(seed) + seen: set[str] = set() + out: list[dict[str, Any]] = [] + for _ in range(50 * n): + if len(out) >= n or hi == 0: + break + row = conn.execute("SELECT title FROM units WHERE unit_id = ?", + [rng.randint(1, hi)]).fetchone() + if row is not None and str(row[0]).strip() and str(row[0]) not in seen: + seen.add(str(row[0])) + out.append({"qid": f"R{len(out)}", "text": str(row[0])}) + return out + + +def keyword_shapes(store: Any, klass: Any, paths: list[str]) -> dict[str, Callable[[str], Any]]: + def hits(found: Any) -> list[list[Any]]: + return [[h.source_path, h.digest, h.chunk_index, h.provenance, h.score.hex()] + for h in found] + return { + "free-class": lambda t: hits(store.search(t, k=10, classes=[klass])), + "free-all": lambda t: hits(store.search(t, k=10)), + "paths-scores": lambda t: sorted([p, s.hex()] for p, s in + store.scores(t, classes=[klass], paths=paths).items()), + "paths-search": lambda t: hits(store.search(t, k=10, classes=[klass], paths=paths)), + } + + +def sample_paths(store: Any, n: int, seed: int) -> list[str]: + paths = sorted(str(r[0]) for r in store._conn.execute( + "SELECT DISTINCT source_path FROM versions")) + return random.Random(seed).sample(paths, min(n, len(paths))) + + +def part_keyword(a: argparse.Namespace, scratch: Path, answers: dict[str, Any]) -> dict[str, Any]: + from core.kernel.provenance import Provenance + from core.stores.lexical import LexicalStore + + d = fresh_dir(scratch / "keyword") + clone(a.stores / "lexical.sqlite", d / "lexical.sqlite") + t_open, ld_open, store = timed(lambda: LexicalStore(d / "lexical.sqlite", + tokenizer=tokenizer(a.tokenizer))) + klass = Provenance(a.klass) + queries = (json.loads(a.queries.read_text()) if a.queries + else pick_queries(store, a.draw, a.seed)) + tok = tokenizer(a.tokenizer) + meta = {} + for q in queries: + terms = sorted(set(tok(q["text"]))) + postings = sum(int(store._conn.execute("SELECT count(*) FROM postings WHERE term = ?", + [t]).fetchone()[0]) for t in terms) + meta[str(q["qid"])] = {"terms": len(terms), "postings": postings} + paths = sample_paths(store, a.paths, a.seed) + shapes = keyword_shapes(store, klass, paths) + path_qids = {str(x) for x in a.path_qids.split(",")} if a.path_qids else None + fresh_qids = {str(x) for x in a.fresh_qids.split(",")} if a.fresh_qids else None + out: dict[str, Any] = {"open_s": t_open, "open_load": ld_open, "queries": meta, + "class": a.klass, "tokenizer": tok.identity, "paths": len(paths), + "units_current": store.count(), "shapes": {}} + for name, fn in shapes.items(): + wanted = [q for q in queries if not name.startswith("paths") + or path_qids is None or str(q["qid"]) in path_qids] + rows = {} + for q in wanted: + r = repeat(partial(fn, q["text"]), a.passes) + answers[f"keyword/{name}/{q['qid']}"] = r.pop("answer") + r["answer"] = digest(answers[f"keyword/{name}/{q['qid']}"]) + rows[str(q["qid"])] = r + print(f"keyword {name} {q['qid']} first {r['first_s']:.3f}s " + f"warm {r['warm']['median_s'] if r['warm'] else 0:.3f}s load {load()}", + flush=True) + out["shapes"][name] = rows + store.close() + qfile = d / "queries.json" + qfile.write_text(json.dumps(queries)) + pfile = d / "paths.json" + pfile.write_text(json.dumps(paths)) + fresh: dict[str, Any] = {} + for name in ("free-class", "paths-scores"): + for q in queries: + if fresh_qids is not None and str(q["qid"]) not in fresh_qids: + continue + if name.startswith("paths") and path_qids is not None \ + and str(q["qid"]) not in path_qids: + continue + reps = [child(["keyword", "--store", str(d / "lexical.sqlite"), "--shape", name, + "--qfile", str(qfile), "--qid", str(q["qid"]), "--pfile", str(pfile), + "--class", a.klass, "--tokenizer", a.tokenizer], a.max_rss_gb) + for _ in range(a.fresh)] + fresh[f"{name}/{q['qid']}"] = reps + print(f"keyword fresh {name} {q['qid']} " + f"{[round(r.get('query_s', -1), 3) for r in reps]}", flush=True) + out["fresh"] = fresh + return out + + +def child_keyword(a: argparse.Namespace) -> dict[str, Any]: + from core.kernel.provenance import Provenance + from core.stores.lexical import LexicalStore + + queries = {str(q["qid"]): q for q in json.loads(Path(a.qfile).read_text())} + paths = json.loads(Path(a.pfile).read_text()) + t_open, _, store = timed(lambda: LexicalStore(Path(a.store), tokenizer=tokenizer(a.tokenizer))) + fn = keyword_shapes(store, Provenance(a.klass), paths)[a.shape] + counted = bool(getattr(store, "_counted", lambda: False)()) + dt, ld, value = timed(lambda: fn(queries[a.qid]["text"])) + return {"open_s": t_open, "query_s": dt, "load": ld, "load_end": load(), + "counted_at_query": counted, "answer": digest(value), "peak_rss_mb": peak_rss_mb()} + + +# ── the attestation ledger ───────────────────────────────────────────────────────────────────── + +def part_ledger(a: argparse.Namespace, scratch: Path, answers: dict[str, Any]) -> dict[str, Any]: + from core.attestation import AttestationStore, StoreAttestor + from core.ingest.landing import already_attested, attested_batch, attested_by + + d = fresh_dir(scratch / "ledger") + clone(a.stores / "attestations.sqlite", d / "attestations.sqlite") + raw = sqlite3.connect(f"file:{d / 'attestations.sqlite'}?mode=ro", uri=True) + rowids = [int(r[0]) for r in raw.execute("SELECT rowid FROM attestations ORDER BY rowid")] + action = str(raw.execute("SELECT action FROM attestations GROUP BY action " + "ORDER BY count(*) DESC, action LIMIT 1").fetchone()[0]) + rng = random.Random(a.seed) + + def first_output(rowid: int) -> str | None: + row = raw.execute("SELECT payload_json FROM attestations WHERE rowid = ?", + [rowid]).fetchone() + outs = json.loads(row[0]).get("output_hashes") or [] + return str(outs[0]) if outs else None + singles = [h for h in (first_output(r) for r in rng.sample(rowids, min(5, len(rowids)))) if h] + singles += ["0" * 64, "f" * 64] + batch = {h for h in (first_output(r) for r in rng.sample(rowids, min(ITEMS, len(rowids)))) + if h} + batch |= {f"{i:064x}" for i in range(1, ABSENT + 1)} + records = len(rowids) + raw.close() + t_open, ld_open, store = timed(lambda: AttestationStore(d / "attestations.sqlite")) + attestor = StoreAttestor(store) + out: dict[str, Any] = {"open_s": t_open, "open_load": ld_open, "records": records, + "action": action, "singles": {}, "batch": {"digests": len(batch)}} + calls: dict[str, Callable[[str], Any]] = { + "producers_of": lambda h: sorted(store.producers_of({h})), + "already_attested": lambda h: already_attested(attestor, action, h), + "attested_by": lambda h: attested_by(attestor, action, h), + } + for name, fn in calls.items(): + rows = {} + for i, h in enumerate(singles): + r = repeat(partial(fn, h), a.passes) + answers[f"ledger/{name}/{i}"] = r.pop("answer") + r["answer"] = digest(answers[f"ledger/{name}/{i}"]) + r["present"] = i < len(singles) - 2 + rows[str(i)] = r + out["singles"][name] = rows + print(f"ledger {name} {[round(r['first_s'], 4) for r in rows.values()]}", flush=True) + for name, bfn in (("producers_by_output", lambda: store.producers_by_output(set(batch))), + ("attested_batch", lambda: attested_batch(attestor, set(batch)))): + r = repeat(bfn, a.passes) + answers[f"ledger/{name}"] = sorted([k, v] for k, v in r.pop("answer").items()) + r["answer"] = digest(answers[f"ledger/{name}"]) + out["batch"][name] = r + print(f"ledger {name} first {r['first_s']:.4f}s", flush=True) + store.close() + return out + + +# ── the landing ──────────────────────────────────────────────────────────────────────────────── + +STATS: dict[str, dict[str, float]] = defaultdict(lambda: {"calls": 0, "seconds": 0.0}) + + +class Timed: + """A store whose public methods are timed and counted; attributes pass through.""" + + def __init__(self, obj: Any, name: str) -> None: + object.__setattr__(self, "_o", obj) + object.__setattr__(self, "_n", name) + + def __getattr__(self, k: str) -> Any: + v = getattr(self._o, k) + if not callable(v) or k.startswith("_") or k == "deferred": + return v + + def call(*args: Any, **kw: Any) -> Any: + t0 = time.perf_counter() + try: + return v(*args, **kw) + finally: + s = STATS[f"{self._n}.{k}"] + s["calls"] += 1 + s["seconds"] += time.perf_counter() - t0 + return call + + +def synthetic_items(source: Path, raw: Path, seed: int, + n: int) -> list[tuple[str, str, str, bytes]]: + """`n` real items made new: (source name, new path, title, bytes with a first line naming the + run and the item), drawn from the catalog in `source`, their bytes read from `raw`.""" + con = sqlite3.connect(f"file:{source / 'vault_catalog.sqlite'}?mode=ro&immutable=1", uri=True) + rows = con.execute("SELECT source_path, digest, title FROM vault_files " + "WHERE active = 1 ORDER BY source_path").fetchall() + con.close() + out = [] + for i, (path, dg, title) in enumerate(random.Random(1000 + seed).sample(rows, n)): + name = str(path).split("/")[1] if "/" in str(path) else "items" + data = (raw / str(dg)[:2] / str(dg)).read_bytes() + out.append((name, f"corpus/{name}/stress-s{seed}-{i}", str(title), + f"[stress s{seed} i{i}]\n".encode() + data)) + return out + + +UPKEEP: dict[str, float] = {"calls": 0, "units": 0, "seconds": 0.0} + + +def time_upkeep(store_class: Any) -> bool: + """Time the lexical index's upkeep of its statistics (`LexicalStore._keep`) where the code has + one: the calls that moved them, the units whose currency they moved, and the seconds of every + call. False for a code without one.""" + keep = getattr(store_class, "_keep", None) + if keep is None: + return False + + def timed_keep(self: Any, changes: dict[int, int]) -> None: + t0 = time.perf_counter() + try: + keep(self, changes) + finally: + UPKEEP["seconds"] += time.perf_counter() - t0 + if changes: + UPKEEP["calls"] += 1 + UPKEEP["units"] += len(changes) + store_class._keep = timed_keep + return True + + +def child_landing(a: argparse.Namespace) -> dict[str, Any]: + """In a fresh process: fresh clones of the stores, then `--batches` plans of `--items` new + items landed through the writer, batched and lazy (or effect by effect with `--single`), and + with `--replace` one more plan landing the last plan's paths again with other bytes.""" + os.environ.setdefault("MIND_PALACE_OVERLAY", CORPUS_OVERLAY) + os.chdir(ROOT) + from core.attestation import AttestationStore, StoreAttestor + from core.ingest.ingress import grant_for + from core.ingest.table import build_table + from core.ingest.writer import Stores, Writer + from core.kernel.clearance import classes_of + from core.kernel.config import load_config + from core.kernel.stores.rawstore import RawStore + from core.sentence.interpret import OBSERVED, Content, Meter, Naming, Origin, StoreEff + from core.stores.catalog import VaultCatalog + from core.stores.lexical import LexicalStore + from core.stores.vectorstore import VectorStore, fingerprint_of + from core.stores.versions import VersionStore + + source = Path(a.source) + raw = Path(a.raw) if a.raw else source / "raw" + d = fresh_dir(Path(a.dir)) + t0 = time.perf_counter() + for name in ("lexical.sqlite", "vault_catalog.sqlite", "attestations.sqlite", + "versions.sqlite"): + clone(source / name, d / name) + clone(source / "vectors.lance", d / "vectors.lance") + upkeep = time_upkeep(LexicalStore) + res: dict[str, Any] = {"clone_s": time.perf_counter() - t0, "load_start": load(), + "single": a.single, "upkeep_timed": upkeep, "batches": []} + cfg = load_config() + table = build_table(cfg) + opens = {} + t, _, lex = timed(lambda: LexicalStore(d / "lexical.sqlite", tokenizer=tokenizer(a.tokenizer))) + opens["lexical"] = t + t, _, cat = timed(lambda: VaultCatalog(d / "vault_catalog.sqlite")) + opens["catalog"] = t + t, _, led = timed(lambda: AttestationStore(d / "attestations.sqlite")) + opens["attestations"] = t + t, _, ver = timed(lambda: VersionStore(d / "versions.sqlite")) + opens["versions"] = t + res["open_s"] = opens + vs = VectorStore(path=d / "vectors.lance", dim=cfg.embedding.dim, embedder=fingerprint_of(cfg)) + ledger: Any = Timed(led, "attestations") + stores = Stores(raw=Timed(RawStore(d / "raw"), "raw"), plane=Timed(vs, "plane"), + embedder=None, catalog=Timed(cat, "catalog"), versions=Timed(ver, "versions"), + attestor=StoreAttestor(ledger), edges=None, + enqueue=None, lexical=Timed(lex, "lexical")) + role = "corpus" + reads = frozenset().union(*(classes_of(s.sigma.strata) for s in grant_for(role).scopes)) + + def units(paths: list[str]) -> tuple[int, int]: + """The unit rows of these paths, and the current ones: by the paths' index, so the count + reads only the batch's rows.""" + total = current = 0 + for i in range(0, len(paths), 400): + batch = paths[i:i + 400] + n, c = lex._conn.execute( + "SELECT count(*), COALESCE(sum(current), 0) FROM units WHERE source_path IN " + f"({', '.join('?' for _ in batch)})", batch).fetchone() + total, current = total + int(n), current + int(c) + return total, current + last: list[tuple[str, str, str, bytes]] = [] + for bi in range(a.batches + (1 if a.replace else 0)): + if bi < a.batches: + kind, its = "new", synthetic_items(source, raw, a.run * 10 + bi, a.items) + else: # the last batch's paths again, other bytes: each a new version + kind, its = "replace", [(n, p, t_, b"[replaced]\n" + x) for n, p, t_, x in last] + last = its + plan = [StoreEff(path=path, content=Content(data, OBSERVED, Origin("item", + f"corpus/{name}", path, title)), place="observed", + naming=Naming("own"), title=title) for name, path, title, data in its] + writer = Writer(table, role, stores, has=lambda _p: True, + meter=Meter(table.roles[role].budget), request=None, reads=reads, + batch=not a.single, lazy=True) + paths = [p for _, p, _, _ in its] + before, (rows0, current0) = led.count(), units(paths) + STATS.clear() + kept0 = dict(UPKEEP) + ld = load() + t0 = time.perf_counter() + landed = writer.land(plan) + dt = time.perf_counter() - t0 + statuses: dict[str, int] = defaultdict(int) + for o in landed: + statuses[o.status] += 1 + rows1, current1 = units(paths) + res["batches"].append({ + "batch": bi, "kind": kind, "items": len(its), "bytes": sum(len(x) for *_, x in its), + "land_s": dt, "items_per_s": len(its) / dt, "load": ld, "load_end": load(), + "statuses": dict(statuses), "stages_s": dict(writer.timing), + "calls": {k: dict(v) for k, v in sorted(STATS.items())}, + "upkeep": ({k: UPKEEP[k] - kept0[k] for k in UPKEEP} if upkeep else None), + "ledger_grew": led.count() - before, "units_landed": rows1 - rows0, + "units_current_delta": current1 - current0}) + print(json.dumps({"batch": bi, "kind": kind, "land_s": round(dt, 3), + "statuses": dict(statuses), "load": ld}), file=sys.stderr, flush=True) + if hasattr(lex, "statistics"): + # the kept class statistics against a count of the units, after the batches + n, tokens = lex._conn.execute( + "SELECT count(*), COALESCE(sum(length), 0) FROM units WHERE current = 1").fetchone() + kept = lex.statistics() + res["statistics"] = {"kept": [kept.units, kept.tokens], "counted": [int(n), int(tokens)], + "equal": (kept.units, kept.tokens) == (int(n), int(tokens))} + res["peak_rss_mb"] = peak_rss_mb() + res["load_end"] = load() + shutil.rmtree(d, ignore_errors=True) + return res + + +def part_landing(a: argparse.Namespace, scratch: Path, *, single: bool) -> dict[str, Any]: + runs = [] + for r in range(1 if single else a.runs): + args = ["landing", "--source", str(a.stores), "--raw", str(a.source / "raw"), + "--dir", str(scratch / f"landing-{r}"), "--run", str(r), + "--tokenizer", a.tokenizer, "--items", str(3 if single else ITEMS), + "--batches", str(1 if single else NEW_BATCHES)] + args.append("--single" if single else "--replace") + rec = child(args, a.max_rss_gb) + runs.append(rec) + print(f"{'single' if single else 'landing'} run {r}: " + f"{[round(b['land_s'], 2) for b in rec.get('batches', [])]} {rec.get('error', '')}", + flush=True) + return {"runs": runs} + + +# ── the drain's pending set ──────────────────────────────────────────────────────────────────── + +def part_pending(a: argparse.Namespace, scratch: Path) -> dict[str, Any]: + from core.ingest.derive import pending + from core.stores.catalog import VaultCatalog + from core.stores.lexical import LexicalStore + from core.stores.vectorstore import VectorStore + + d = fresh_dir(scratch / "pending") + for name in ("lexical.sqlite", "vault_catalog.sqlite"): + clone(a.stores / name, d / name) + clone(a.stores / "vectors.lance", d / "vectors.lance") + cat = VaultCatalog(d / "vault_catalog.sqlite") + lex = LexicalStore(d / "lexical.sqlite", tokenizer=tokenizer(a.tokenizer)) + plane = VectorStore(path=d / "vectors.lance", dim=a.dim) + r = repeat(lambda: len(pending(cat, plane, lexical=lex)), a.passes) + r["pending"] = r.pop("answer") + lex.close() + return r + + +# ── a store opened while another process migrates it ────────────────────────────────────────── + +def one_query(a: argparse.Namespace, path: Path) -> dict[str, Any]: + """The concurrent part's query: the first of `--fresh-qids` among `--queries`, else a title of + the store read without opening it as a store (an open would migrate it).""" + if a.queries: + queries = json.loads(a.queries.read_text()) + wanted = a.fresh_qids.split(",")[0] if a.fresh_qids else None + return dict(next((q for q in queries if str(q["qid"]) == wanted), queries[0])) + raw = sqlite3.connect(f"file:{path}?mode=ro&immutable=1", uri=True) + row = raw.execute("SELECT title FROM units WHERE current = 1 AND title <> '' " + "ORDER BY unit_id LIMIT 1").fetchone() + raw.close() + return {"qid": "R0", "text": str(row[0]) if row else ""} + + +def child_open(a: argparse.Namespace) -> dict[str, Any]: + """In a fresh process: open the lexical index (a migration, when it needs one), then close.""" + from core.stores.lexical import LexicalStore + + t, ld, store = timed(lambda: LexicalStore(Path(a.store), tokenizer=tokenizer(a.tokenizer))) + counted = bool(getattr(store, "_counted", lambda: False)()) + store.close() + return {"open_s": t, "load": ld, "load_end": load(), "migrated": counted, + "peak_rss_mb": peak_rss_mb()} + + +def part_concurrent(a: argparse.Namespace, scratch: Path) -> dict[str, Any]: + """A lexical index from before the change (the source's own) opened by a first process and, + `--concurrent-delay` seconds later, by a second that asks one query with the class filter, + as a reader opens the index while the first open migrates it.""" + d = fresh_dir(scratch / "concurrent") + path = d / "lexical.sqlite" + clone(a.source / "lexical.sqlite", path) + q = one_query(a, path) + qfile, pfile = d / "query.json", d / "paths.json" + qfile.write_text(json.dumps([q])) + pfile.write_text("[]") + env = {**os.environ, "PYTHONDONTWRITEBYTECODE": "1"} + ld = load() + first = subprocess.Popen([sys.executable, "-m", "eval.stress_battery", "child", "open", + "--store", str(path), "--tokenizer", a.tokenizer, + "--max-rss-gb", str(a.max_rss_gb)], cwd=ROOT, env=env, + stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + time.sleep(a.concurrent_delay) + second = child(["keyword", "--store", str(path), "--shape", "free-class", "--qfile", + str(qfile), "--qid", str(q["qid"]), "--pfile", str(pfile), "--class", + a.klass, "--tokenizer", a.tokenizer], a.max_rss_gb) + out, err = first.communicate() + opened = (dict(json.loads(out.strip().splitlines()[-1])) if first.returncode == 0 + else {"error": f"exit {first.returncode}", "stderr": err[-2000:]}) + print(f"concurrent: first {opened.get('open_s', opened.get('error'))} second " + f"{second.get('open_s', second.get('error'))} {second.get('query_s', '')}", flush=True) + return {"query": str(q["qid"]), "delay_s": a.concurrent_delay, "load": ld, "first": opened, + "second": second, "load_end": load()} + + +# ── the battery ──────────────────────────────────────────────────────────────────────────────── + +def run(a: argparse.Namespace) -> dict[str, Any]: + scratch = Path(a.scratch) + scratch.mkdir(parents=True, exist_ok=True) + rec: dict[str, Any] = { + "battery": "stress", "started": datetime.now(UTC).isoformat(timespec="seconds"), + "code": code_label(), "load_start": load(), "python": platform.python_version(), + "sqlite": sqlite3.sqlite_version, "machine": platform.machine(), + "cpus": os.cpu_count(), "args": {k: str(v) for k, v in vars(a).items()}, "parts": {}} + answers: dict[str, Any] = {} + out = Path(a.out) + out.parent.mkdir(parents=True, exist_ok=True) + parts = a.parts.split(",") + for part in parts: + if part not in PARTS: + raise SystemExit(f"no part {part!r}; one of {', '.join(PARTS)}") + a.stores = a.source + if {"keyword", "ledger", "landing", "single", "pending"} & set(parts): + a.stores, rec["prepare"] = prepare(a, scratch) + out.write_text(json.dumps(rec, indent=1)) + for part in parts: + t0 = time.perf_counter() + try: + if part == "keyword": + res = part_keyword(a, scratch, answers) + elif part == "ledger": + res = part_ledger(a, scratch, answers) + elif part in ("landing", "single"): + res = part_landing(a, scratch, single=part == "single") + elif part == "pending": + res = part_pending(a, scratch) + elif part == "concurrent": + res = part_concurrent(a, scratch) + else: + res = {"status": NOT_RUN[part]} + except Exception as exc: # noqa: BLE001 - a part that fails is a result, recorded + res = {"error": f"{type(exc).__name__}: {exc}"} + res["part_s"] = time.perf_counter() - t0 + rec["parts"][part] = res + rec["peak_rss_mb"] = peak_rss_mb() + out.write_text(json.dumps(rec, indent=1)) + Path(str(out) + ".answers.json").write_text(json.dumps(answers)) + rec["load_end"] = load() + rec["finished"] = datetime.now(UTC).isoformat(timespec="seconds") + out.write_text(json.dumps(rec, indent=1)) + return rec + + +def main(argv: list[str] | None = None) -> None: + argv = sys.argv[1:] if argv is None else argv + if argv and argv[0] == "child": + ap = argparse.ArgumentParser(prog="stress_battery child") + ap.add_argument("kind", choices=["keyword", "landing", "open"]) + ap.add_argument("--store") + ap.add_argument("--shape") + ap.add_argument("--qfile") + ap.add_argument("--qid") + ap.add_argument("--pfile") + ap.add_argument("--class", dest="klass", default="observed") + ap.add_argument("--tokenizer", default="current") + ap.add_argument("--source") + ap.add_argument("--raw") + ap.add_argument("--dir") + ap.add_argument("--run", type=int, default=0) + ap.add_argument("--items", type=int, default=ITEMS) + ap.add_argument("--batches", type=int, default=3) + ap.add_argument("--single", action="store_true") + ap.add_argument("--replace", action="store_true") + ap.add_argument("--max-rss-gb", type=float, default=3.8) + c = ap.parse_args(argv[1:]) + guard(c.max_rss_gb) + res = {"keyword": child_keyword, "landing": child_landing, "open": child_open}[c.kind](c) + print(json.dumps(res)) + return + a = parse(argv) + guard(a.max_rss_gb) + run(a) + + +def parse(argv: list[str]) -> argparse.Namespace: + """The battery's arguments.""" + ap = argparse.ArgumentParser(description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter) + ap.add_argument("--source", type=Path, required=True, + help="an instance's data directory; cloned, never written") + ap.add_argument("--scratch", type=Path, required=True, help="where the clones go") + ap.add_argument("--out", type=Path, required=True, help="the JSON record") + ap.add_argument("--parts", default=",".join(PARTS)) + ap.add_argument("--queries", type=Path, help="a JSON list of {qid, text}; else drawn") + ap.add_argument("--draw", type=int, default=16, help="titles drawn when no --queries") + ap.add_argument("--path-qids", default="", help="the queries of the path shapes (all)") + ap.add_argument("--fresh-qids", default="", help="the queries timed a fresh process each") + ap.add_argument("--tokenizer", choices=["legacy", "current"], default="current") + ap.add_argument("--class", dest="klass", default="observed") + ap.add_argument("--passes", type=int, default=3) + ap.add_argument("--fresh", type=int, default=3) + ap.add_argument("--paths", type=int, default=400) + ap.add_argument("--runs", type=int, default=3) + ap.add_argument("--dim", type=int, default=768) + ap.add_argument("--seed", type=int, default=20261111) + ap.add_argument("--concurrent-delay", type=float, default=5.0, + help="seconds between the two opens of the concurrent part") + ap.add_argument("--max-rss-gb", type=float, default=3.8) + return ap.parse_args(argv) + + +if __name__ == "__main__": + main() diff --git a/papers/2026-11-11-keyword-and-ledger/paper.tex b/papers/2026-11-11-keyword-and-ledger/paper.tex new file mode 100644 index 00000000..ce1380bb --- /dev/null +++ b/papers/2026-11-11-keyword-and-ledger/paper.tex @@ -0,0 +1,483 @@ +% The article for the keyword-and-ledger pull request: kept statistics, one statement, and an +% index of the attestation ledger by output hash, measured on the corpus instance. +\documentclass[11pt]{article} +\usepackage[T1]{fontenc} +\usepackage{lmodern} +\usepackage{microtype} +\usepackage[margin=1in]{geometry} +\usepackage{amsmath,amssymb,amsthm,mathtools} +\usepackage{algorithm} +\usepackage{algpseudocode} +\usepackage{booktabs} +\usepackage{array} +\usepackage[numbers,sort&compress]{natbib} +\usepackage[hidelinks]{hyperref} +\usepackage[capitalise,noabbrev]{cleveref} + +\setlength{\emergencystretch}{3em} +\renewcommand{\topfraction}{0.9} +\renewcommand{\textfraction}{0.05} +\renewcommand{\floatpagefraction}{0.75} + +\theoremstyle{plain} +\newtheorem{theorem}{Theorem}[section] +\newtheorem{lemma}[theorem]{Lemma} +\newtheorem{proposition}[theorem]{Proposition} +\newtheorem{corollary}[theorem]{Corollary} +\theoremstyle{definition} +\newtheorem{definition}[theorem]{Definition} +\theoremstyle{remark} +\newtheorem{remark}[theorem]{Remark} + +\newcommand{\code}[1]{\texttt{#1}} +\newcommand{\fl}{\operatorname{fl}} +\newcommand{\df}{\operatorname{df}} + +% The measured figures, from docs/experiments/keyword-and-ledger-2026-11-11.json. +\newcommand{\nItems}{400{,}274} +\newcommand{\nUnits}{1{,}369{,}944} +\newcommand{\nPostings}{117{,}975{,}818} +\newcommand{\nRecords}{387{,}838} +\newcommand{\nPaths}{400} +\newcommand{\nBatch}{2{,}050} +\newcommand{\nQueries}{16} +\newcommand{\nAnswers}{65} +\newcommand{\kwBefore}{14.4} +\newcommand{\kwBeforeMax}{34.1} +\newcommand{\kwAfter}{1.20} +\newcommand{\kwAfterMax}{6.17} +\newcommand{\pathsBefore}{5.41} +\newcommand{\pathsAfter}{5.9} +\newcommand{\ledgerBefore}{2.43} +\newcommand{\ledgerAfter}{8} +\newcommand{\singleBefore}{7.6} +\newcommand{\singleAfter}{0.16} +\newcommand{\migrationLex}{114.5 to 126.0} + +\title{Keyword Search and Ledger Lookups at Corpus Scale:\\ +Kept Statistics, One Statement, and an Index by Output Hash} +\author{Alberto Serrano-Calva} +\date{November 11, 2026} + +\begin{document} +\maketitle + +\begin{abstract} +A knowledge store answers keyword queries from a BM25 index kept in SQLite and links every +attestation of its append-only ledger to the attestations that produced its inputs. On the +store's corpus instance, \nItems{} items in \nUnits{} lexical units with \nPostings{} postings and +\nRecords{} attestations, a title query under the class filter the store always applies took a +warm median of \kwBefore{}~s and up to \kwBeforeMax{}~s, the store's own query shape (a class and +\nPaths{} paths) \pathsBefore{}~s, and the producers of one digest \ledgerBefore{}~s, a lookup an +item landed on its own asks three times. Neither cost is in the data. With no planner statistics, +SQLite counted each query term's document frequency by visiting every unit, and the ledger was +decoded record by record in Python. We keep the statistics instead of counting them: per class, +the current units and their total length, and per class and term the current units holding the +term, moved in the transaction of every write that changes which units are current, so a reader's +statistics remain the sums of its cleared classes' rows and a filtered read remains a function of +the cleared rows alone. Scoring is one statement that starts from the query terms' postings or +from the given paths' units and writes the sum over the terms out in their order, since SQLite's +own sum compensates its rounding: the scores are the old statements' to the last bit. The ledger +gains a table from each output hash to its record and action, written by a trigger in the +append's own statement. On the same clone the warm medians become \kwAfter{}~s, \pathsAfter{}~ms +and \ledgerAfter{}~\textmu s, items landed one at a time go from \singleBefore{}~s to +\singleAfter{}~s an item, a batch of 2{,}000 items lands 7 to 11\% slower, and every one of the +\nAnswers{} answers compared is identical to the one before. Property tests check the identity, +the statistics against a recount after any sequence of writes, the clearance rule, and the ledger +table against a scan. +\end{abstract} + +\section{Introduction}\label{sec:intro} + +The store this article concerns keeps two indexes that grow with everything it lands. The lexical +index holds the chunks of every landed item as BM25 postings \citep{robertson2009bm25}, one row a +term a unit, beside each unit's path, version, class, length and a flag that marks the current +version of its path; a lexical \code{near} reads it, and so does the check that tells a landing +whether an item is already held. The attestation ledger records every action with the hashes of +its inputs and outputs; an attestation's parents are the attestations that produced its inputs, +found by asking which records name a hash among their outputs, and a landing asks whether its +digest is attested already before it attests it. + +A corpus instance was built to find where the store stops scaling. At its first stage it holds +\nItems{} items, every one of them in the lexical index (\nUnits{} units, \nPostings{} postings) +and in the ledger (\nRecords{} records). Both questions above were past any budget there. A keyword +query took seconds to tens of seconds, and its cost was the number of units, not the number of +postings it read; the producers of one digest took \ledgerBefore{}~s, and a landing that goes item +by item asks three times an item. This article removes both costs without changing an answer. +The contributions: + +\begin{enumerate} +\item Statistics kept, not counted (\cref{sec:theory,sec:impl}): per class and per class and term, + moved by the net currency changes of each transaction, read before any posting of a changed unit + is deleted, with a proof that the tables equal a recount after every committed transaction and + that a reader's statistics depend on its cleared classes' units alone. +\item One statement (\cref{sec:impl}): the arithmetic, the sum over the terms and the top $k$ in + SQL, from the postings or from the paths' units, with the sum written out in the reference's + order, which makes the result the reference's to the bit where SQLite's \code{sum()} does not. +\item An index of the ledger by output hash, kept by a trigger, so that every writer, of any + version, keeps it in its own statement. +\item A stress battery that runs on a copy-on-write clone of an instance's stores, and the + measurements before and after the change (\cref{sec:eval}). +\end{enumerate} + +\section{Background and related work}\label{sec:background} + +BM25 scores a unit $d$ for a query $q$ as a sum over the query's distinct terms, +\[ + s(q, d) = \sum_{t \in q} \mathrm{idf}(t)\, + \frac{\mathit{tf}(t, d)\,(k_1 + 1)}{\mathit{tf}(t, d) + k_1 (1 - b + b\,\ell(d)/\bar\ell)}, + \qquad + \mathrm{idf}(t) = \ln\!\Big(1 + \frac{n - \df(t) + 0.5}{\df(t) + 0.5}\Big), +\] +with $k_1 = 1.2$ and $b = 0.75$, where $n$ is the number of units, $\bar\ell$ their mean length and +$\df(t)$ the units holding $t$ \citep{robertson2009bm25}. Every quantity but $\mathit{tf}$ and +$\ell(d)$ is a statistic of the collection, and in this store the collection is a reader's: the +current units of the classes it is cleared for. An inverted index serves the sum by reading the +postings of the query's terms \citep{zobel2006inverted}, term at a time or document at a time, and +pruning methods skip postings that cannot reach the top $k$ \citep{turtle1995query}. + +A relational engine chooses the order of a join from statistics of the tables +\citep{selinger1979access}. The store's SQLite file had none, and without them the engine took an +equality on the index \code{(current, provenance)} as being as selective as an equality on a term: +it counted a term's document frequency by visiting every current unit and probing the postings for +each, a million probes a term whatever the term. Statements can name their order instead +(\code{CROSS JOIN}, which SQLite never reorders) and their index (\code{INDEXED BY}), so the plan +does not depend on what the planner believes. + +A sum of floating-point numbers depends on the order of its terms +\citep{ieee754-2019,higham1993accuracy}. Compensated summation carries the rounding error of each +addition into the next \citep{kahan1965further,neumaier1974rundungsfehler}: it is more accurate, +and for that reason it is a different function of the same terms. SQLite's \code{sum()} and +\code{total()} return the compensated sum (\cref{rem:compensated} shows a case), so a score summed +by them is not the score the store's Python loop computed. + +The store's clearance rule is a noninterference requirement \citep{goguen1982security}: what a +reader sees must be a function of what it is cleared to see. For BM25 it reaches the statistics: a +filter applied after scoring with every class's statistics would let the scores reveal uncleared +units, which is why engines that keep one set of statistics for everything they hold do not meet +it unless given a table a cleared set. Kept statistics meet it when they are kept per class and a +reader sums its own classes' rows. The upkeep must be atomic with the writes it follows +\citep{haerder1983principles}: a transaction that changes the units and dies before the +statistics must leave neither. + +\section{The kept statistics and the written-out sum}\label{sec:theory} + +\begin{definition}[Statistics] +A store holds units $u$, each with a class $c(u)$, a length $\ell(u)$, a currency bit +$\kappa(u) \in \{0, 1\}$ and postings $P(u)$, a set of terms. For a class $c$ and a term $t$, +\[ + N_c = \textstyle\sum_{u : c(u) = c} \kappa(u), \quad + L_c = \textstyle\sum_{u : c(u) = c} \kappa(u)\,\ell(u), \quad + D_{c,t} = \textstyle\sum_{u : c(u) = c,\, t \in P(u)} \kappa(u). +\] +The kept tables hold $(c, N_c, L_c)$ for $N_c > 0$ and $(t, c, D_{c,t})$ for $D_{c,t} > 0$. A +reader cleared for a set of classes $C$ scores with $n = \sum_{c \in C} N_c$, +$\bar\ell = \sum_{c \in C} L_c / n$ and $\df(t) = \sum_{c \in C} D_{c,t}$. +\end{definition} + +A transaction changes some units' currency, writes new units with their postings (not current), and +may delete a version's units with their postings. Let $\delta(u) = \kappa'(u) - \kappa(u)$ be the +net change of $u$ over the transaction, which is $0$ for a unit made current and then superseded +within it. + +\begin{proposition}[The tables are a recount]\label{prop:recount} +Suppose a transaction adds $\delta(u)$ to $N_{c(u)}$, $\delta(u)\,\ell(u)$ to $L_{c(u)}$ and +$\delta(u)$ to $D_{c(u),t}$ for each $t \in P(u)$, reading $P(u)$ while $u$'s postings are still +those it had while current, drops the rows that reach zero, and commits with its writes or not at +all. Then after every committed transaction the tables equal the statistics counted from the +units. +\end{proposition} + +\begin{proof}[Sketch] +Each statistic is a sum over units of $\kappa(u)$ times a weight that depends on $u$ alone ($1$, +$\ell(u)$, or the indicator of $t \in P(u)$). A unit whose currency the transaction leaves alone +contributes the same before and after: new units enter with $\kappa = 0$ and their postings, and +postings are deleted only with their unit, after its change has been applied. A changed unit's +contribution changes by $\delta(u)$ times its weight, which is what is added; reading $P(u)$ +before any of its postings is deleted makes the weight the one the unit had while current. By +induction on committed transactions, from a store counted once by the migration (or empty after a +reset), the tables equal the recount. A transaction that dies commits neither its units nor its +deltas. +\end{proof} + +\begin{proposition}[A reader's statistics are its classes' own]\label{prop:clearance} +For any two stores whose units of the classes in $C$ are the same, a reader cleared for $C$ is +given the same $n$, $\bar\ell$ and $\df$, and so the same scores for every query. +\end{proposition} + +\begin{proof}[Sketch] +$N_c$, $L_c$ and $D_{c,t}$ for $c \in C$ are sums over units of class $c$; the reader's statistics +are sums of these alone, and its rows are read from units of classes in $C$. +\end{proof} + +The statement adds a unit's per-term weights in the order of the sorted query terms. Writing that +sum out in SQL needs a value for the terms the unit lacks; it is $0.0$. + +\begin{proposition}[The written-out sum is the reference's]\label{prop:sum} +Let $w_1, \dots, w_m$ be positive finite doubles and $x_j = w_j$ for $j$ in a set $J$ and +$x_j = 0$ otherwise. Then +$\fl(\cdots\fl(\fl(x_1 + x_2) + x_3)\cdots + x_m)$ equals the left fold over $J$ in increasing +order starting from $0$, $\fl(\cdots\fl(\fl(0 + w_{j_1}) + w_{j_2})\cdots)$. +\end{proposition} + +\begin{proof}[Sketch] +IEEE~754 addition is correctly rounded \citep{ieee754-2019}, and the exact sum of a finite $s \ge 0$ +and $0$ is $s$, a double; so $\fl(s + 0) = s$, and a term the unit lacks leaves the partial sum as +it is. The partial sums before $j_1$ are $0$, and $\fl(0 + w_{j_1}) = w_{j_1}$. From there the two +sequences add the same terms to the same partial sums in the same order. Each weight is computed +with the reference's operations in the reference's order on the same operands, so it is the same +double. +\end{proof} + +\begin{remark}\label{rem:compensated} +Compensated summation is not that fold. For $1 + 2^{-53} + 2^{-53}$ the left fold gives $1$ +(each addition rounds to even) and the compensated sum gives $1 + 2^{-52}$, which is what SQLite's +\code{sum()} returns over the same rows in the same order (the control test). +\end{remark} + +The ledger's table is simpler. A trigger on the ledger inserts, for an appended record $a$ and +each position $j$ of its output hashes, the row $(h_j(a), \mathrm{id}(a), \mathrm{action}(a), j)$, +in the statement that appends $a$; an append that is ignored (the record exists) or rolled back +writes none. So after every committed statement the table is exactly the set of such rows over the +ledger, and each lookup is a function of that set: the producers of a set of hashes are the ids +of its rows with those hashes, the producers by output group the (action, id) pairs of the rows by +hash, one pair a row, as the records list them, and the producers of one action are those pairs +filtered by action, each id once. + +\section{Implementation}\label{sec:impl} + +\paragraph{The tables and the migration.} Two tables beside the units in the same file hold +the statistics, \code{class\_stats} with a class's units and tokens and \code{term\_stats} with a +term's units in a class, keyed by the class and by the term and class. A store from before them counts them on its first open, in one transaction: the +classes from the units, then for each class one pass over the postings in their key order with +the units joined by id, so the counts arrive grouped by term and no sort is needed. A store whose +units another tokenizer made is not counted: it neither lands nor scores until it is reset and +re-derived, and its reset counts the empty store. A key in the store's \code{meta} table marks the +statistics counted, and the transaction that counts them creates their tables, so opening an old +store writes nothing unless it counts. The count does not wait for the file's write lock. A process +that opens the store while another holds it, counting or writing, opens at once, and until the +statistics are counted its queries count their own from the units, as every query did before: +the same integers, so the same scores. The first open or query that finds the lock free counts +them, in that call. A writer waits for the lock as any write does. A count that fails for another +reason, a file the process cannot write or a full disk, is rolled back and leaves the store as it +was, and its queries count their own until it is opened again: no open or query fails because of +the count. + +\paragraph{The upkeep.} \Cref{alg:upkeep} is the landing's part; a retire is its last two lines. +The currency moves by two statements a version, each returning the ids it changed, and the net +change of each unit is kept in a map for the whole batch, so a unit made current and superseded +within it costs nothing. A version landed again with other chunks deletes its units: the units of +it that were current leave the statistics first, while their postings exist. The deltas are +applied once a batch, as one grouped read of the changed units' postings and one upsert a +(term, class) pair. Row triggers on the units would keep the same tables with no code in the +store, but a row trigger fires for each unit and makes one upsert for each of its postings, +86 a unit on average in the corpus, where the batch makes one for each distinct (term, class) +pair of all its units together; the batch is the design. + +\begin{algorithm}[t] +\caption{The statistics' upkeep inside one landing transaction.}\label{alg:upkeep} +\begin{algorithmic}[1] +\Require versions $(p, v, \mathit{class}, \mathit{chunks})$; a map $\Delta$ from unit to net change +\State begin; hold the writer's key in \code{meta} +\For{each version $(p, v)$} + \If{the units held for $(p, v)$ are not the chunks} + \State $\Delta \mathrel{-}= $ the units of $(p, v)$ set not current + \State apply and remove $\Delta$'s entries for those units \Comment{their postings still exist} + \State delete their postings and units; write the chunks' units (not current) and postings + \EndIf + \State $\Delta \mathrel{-}= $ units of $p$'s other versions set not current \Comment{\code{RETURNING}} + \State $\Delta \mathrel{+}= $ units of $(p, v)$ set current +\EndFor +\State apply $\Delta$: per sign, group the units' postings by (term, class); upsert; drop zeros +\State release the writer's key; commit +\end{algorithmic} +\end{algorithm} + +\paragraph{The guard.} The upkeep is this class's; a process that writes the units without it, an +older version of the store still running when the store was migrated, would leave the statistics +wrong and nothing would show it. So once the statistics are counted, three triggers on the units +refuse an insert, a currency or class change, and a delete unless the writing transaction holds a +key in \code{meta}, which the class's transactions write at their start and remove before they +commit, so no other connection ever sees it. The postings need no guard: they are written and +deleted only with their unit. The cost is one primary-key lookup in \code{meta} for each unit +written, changed or deleted. + +\paragraph{The statement.} A query's terms with a document frequency above zero go into a +temporary table with their positions $i$ in sorted order and their weights $\mathrm{idf}$; the +paths, when given, into another. The rows are read postings first, +\code{q CROSS JOIN postings p ON p.term = q.term CROSS JOIN units u ON u.unit\_id = p.unit\_id}, +or paths first, \code{paths w CROSS JOIN units u INDEXED BY units\_path ON u.source\_path = w.path +AND u.current = 1}, then the postings by (term, unit). Each row's weight is +\code{q.w * ((p.tf * ?) / (p.tf + ? * (? + (? * u.length) / ?)))}, with $k_1 + 1$, $k_1$, $1 - b$, +$b$ and $\bar\ell$ bound as doubles computed as the reference computes them; the rows are grouped +by unit, the score is \code{COALESCE(max(c) FILTER (WHERE i = 0), 0.0) + COALESCE(max(c) FILTER +(WHERE i = 1), 0.0) + \dots} in that order (\cref{prop:sum}; a filtered aggregate is not called for +the rows of the other terms, which makes the titles of seven terms or more 17 to 28\% faster than +the same sum written with \code{CASE}, in an interleaved comparison on one clone), and +\code{ORDER BY score DESC, unit\_id LIMIT k} returns the top, ties by unit id as before. \code{scores()}, each path's best unit, is the same statement grouped by path with +\code{max}. SQLite parses the written-out sum as a tree as deep as its terms and refuses a depth +over 1{,}000, so a query of more than 500 distinct terms has the same weights read out of the +statement in the terms' order and summed in Python, the reference's sum again. Without +\code{INDEXED BY}, SQLite drove the paths shape from the class's index and visited every current +unit of the class for each path. + +\paragraph{The ledger.} \code{output\_hashes(hash, att\_id, action, pos)}, keyed by hash, record +and position, is created, filled from the records by one \code{json\_each} pass and given its +trigger in one transaction on the first open of a ledger without it. That migration does not wait +for the lock either, nor runs inside a transaction already open on the connection, and one that +fails for another reason is rolled back and tried again at the next open; until the table exists, +the lookups answer from one pass over the records, the hashes asked for given as one JSON array, +which reads no temporary table and opens no transaction. The lookups read it by seeks, a statement +for a few hundred hashes, and only read: the statement it replaced filled a temporary table, which +in the ledger's transaction mode opened a transaction that kept a shared lock on the file until the +connection next committed. \code{attested\_by} and \code{already\_attested} read the producers by +output and keep the action asked for; a store without the lookup by output (a test's scan-only +stand-in) is asked the old way. + +\section{Evaluation}\label{sec:eval} + +\paragraph{Method.} \code{eval/stress\_battery.py} clones an instance's stores with \code{cp -c} +(a copy-on-write clone: nothing of the source is opened for writing) and first prepares a source of +its own: its clones of the lexical index and the ledger, opened once by the code under test, which +migrates a store from before the change there, timed. Every part then clones the prepared files +again, so each part of each code starts on files the cache has not read. The battery: keyword +queries free (the class filter and none) and in the store's call shape (a class and \nPaths{} random +item paths, \code{scores} and \code{search}), warm in one process (the first pass apart, then five, +each pass's wall and processor time kept) and in a fresh process a query (three repetitions); the +producers of single digests and of a batch of \nBatch{}; synthetic items landed through the writer, +batched and lazy, in three processes, each three batches of 2{,}000 new items and a fourth that lands +the third's paths again with other bytes, replacing every unit that batch made current, with the +statistics' upkeep timed on its own; three items landed one at a time; the drain's pending set, +which no line of the change reads, as a control of the machine; and a lexical file from before the +change opened by one process and, 5~s later, by a second that asks one query. A synthetic item is a +real item of the corpus with one first line added, so its digest is new and its text, chunks and +terms are a real item's. The queries are \nQueries{} titles, ten from an earlier, unpublished study +of the stores and six drawn independently, with one to nineteen distinct terms and 32 to 6.5 +million postings, named by their sizes and never by their text. The corpus's lexical file predates +the store's record of its tokenizer, so it is opened with the tokenizer that made it. The machine +is an Apple M2 Pro with 12 cores and 32~GB, shared with other work: every timing carries the +one-minute load average beside it, BLAS is capped at four threads, and every process ends itself +above 3.8~GB resident. One run before the change, on its parent commit, and one after; three +earlier runs, with a version of the battery that had no prepared source and three passes, are in +the record. Not run: the whole-stratum load of a sentence admitting the dialogue stratum (tens of +gigabytes on the whole corpus), the test that a commit's cut holds a citation edge (the corpus has +no citation store) and the pending mask of a sentence's nodes (nothing is pending). + +\begin{table}[t] +\centering +\caption{Before and after on clones of the corpus instance: warm medians (over the queries, of +each query's median of five passes), with the range over the queries, and the one-minute load +average, before / after.}\label{tab:results} +\small +\begin{tabular}{@{}lrrr@{}} +\toprule +measure & before & after & load \\ +\midrule +title query, class filter (16) & 14.4 s (1.49--34.1 s) & 1.20 s (0.08 ms--6.17 s) & 3.0--5.6 / 2.7--3.8 \\ +title query, no filter (16) & 9.58 s (0.97--23.3 s) & 1.16 s (0.07 ms--5.78 s) & 2.2--5.0 / 2.7--3.7 \\ +the store's shape, \code{scores} (5) & 5.41 s (1.19--15.1 s) & 5.9 ms (1.9--12.4 ms) & 2.2--3.0 / 2.8 \\ +the store's shape, \code{search} (5) & 5.39 s (1.20--15.0 s) & 4.7 ms (1.8--11.5 ms) & 1.9--2.6 / 2.8 \\ +fresh process, 14 terms, class filter & 24.0--24.2 s, 469 MB & 4.03--4.04 s, 73 MB & 2.5--3.1 / 2.7--2.8 \\ +producers of one digest & 2.43 s & 8.2 \textmu s & 1.9--2.7 / 2.9 \\ +\code{attested\_by} through the landing & 2.42 s & 8.1 \textmu s & 2.6--3.4 / 2.9 \\ +producers of 2{,}050 digests & 292 ms & 6.4 ms & 3.1 / 2.9 \\ +landing 2{,}000 new items, batches 1--2 & 10.45 s & 11.13 s & 2.3--2.9 / 2.7--3.8 \\ +landing 2{,}000 replacing versions & 9.88 s & 10.93 s & 2.1--2.8 / 3.3--3.8 \\ +three items one at a time & 22.8 s & 0.48 s & 2.3 / 3.9 \\ +the drain's pending set (control) & 2.19 s & 2.22 s & 2.1--2.3 / 3.6--3.8 \\ +\bottomrule +\end{tabular} +\end{table} + +\paragraph{Results.} \Cref{tab:results}. The title queries under the class filter fall from a +median of \kwBefore{}~s to \kwAfter{}~s and the slowest from \kwBeforeMax{}~s to \kwAfterMax{}~s. +A free query still reads every posting of its terms, under 1~\textmu s a posting, but no term +costs a visit of every unit any more. The store's own call shape falls from \pathsBefore{}~s to +\pathsAfter{}~ms. In a fresh process the class-filtered title of 14 terms falls from 24~s to 4.0~s +and its peak memory from 469~MB to 73~MB, with the dictionary of every scored unit the old loop +built, and the paths shape of the same title from 15~s to 14~ms. The producer lookup falls from +\ledgerBefore{}~s to \ledgerAfter{}~\textmu s and the batch's from 292~ms to 6.4~ms once the table +has been read; a first batch on a file the cache has not read takes 295~ms. Landing items one at a +time, \singleBefore{}~s an item before, 99\% of it the three passes over the ledger, takes +\singleAfter{}~s. A batched landing pays for the upkeep: a batch of 2{,}000 new items takes 11.1~s +against 10.4~s (7\% more), the upkeep 0.39~s of it, and a batch that replaces 2{,}000 versions +10.9~s against 9.9~s (11\% more), the upkeep 0.76~s, at a load 0.5 to 1 higher; the trigger adds +28 to 43~\textmu s an append, the ledger's lookup saves 0.2 to 0.5~s a batch, and the rest of the +rise is not attributed. The pending set, which no part of the change reads, took 2.19~s and 2.22~s, +so the runs met the same machine within 2\%. Before the change ten passes of the slowest +class-filtered titles took up to 1.75 times their processor time at loads of 3.1 to 5.6, and the +medians of two carry those waits; after it no pass waited. The migrations run once a store: +counting the statistics of the \nUnits{} units took \migrationLex{}~s on clones the cache had not +read and added 29.6~MB to the 4.6~GB file; the ledger's table took 1.8 to 2.7~s and added 64~MB, +166~B a record. A process that opened the lexical file 5~s into another's count opened at once +and answered its query from the units in 1.4~s, as the code before the change answers it. Every +one of the \nAnswers{} answers the battery keeps (top tens with their scores, path scores, producer +sets and lists) is identical before and after, scores compared as the bits of their doubles, in +all five runs, and so are the fresh processes' answers. + +\paragraph{Tests.} Over generated stores of four classes, three tokenizers, shared vocabularies +(so scores tie), empty and absent classes and paths given and not, the statement's top $k$ and +scores equal the old statements' (kept as the reference) for $k \in \{-1, 0, 1, 2, 3, 10\}$, and +so do they with the sum taken outside the statement (its threshold lowered to one term) and for a +query of 1{,}200 terms; after any sequence of landings, landings again with other chunks, batched +landings that land a path more than once in one transaction, retires and re-derivations, the +tables equal a recount, also after reopening; and a store that also holds other classes' units, +landed and retired around the cleared ones, gives a cleared reader the statistics, scores and +ranking of a store that holds the cleared units alone. Each runs 60 examples in the suite and +passed 1{,}000 in a longer run. A store written by the old code counts its statistics on its +first open, and one +opened while another connection holds its write lock opens at once and answers as the old +statements do, as does one whose count fails because this process cannot write the file or the +file is full; a stale one waits for its reset; a write to the units from another connection is +refused, also the old landing, until the runbook's revert step drops the guard, which a store of +the change still open installs again at its next query; a landing or a retire that dies at the +statistics, after its unit rows or its currency are written (the test +records them before it dies), by an exception or by the process ending, leaves neither; and a write +whose first statement fails leaves no transaction open. For the ledger, after any sequence of +appends, appends again, and deferred blocks that commit or die, the table equals a scan of the +records, and the four lookups answer what the scan and the replaced statement answer, also on a +ledger the old code wrote, after other writers append to it, while another connection holds its +lock, when this process cannot write it, and when it is full; those two properties run 80 examples +in the suite and passed 1{,}000 in the longer run. + +\section{Limitations}\label{sec:limits} + +A free query still reads every posting of its terms, and its time grows with them (\kwAfterMax{}~s +for the query with 6.5 million postings); pruning would read a fraction \citep{turtle1995query}. +The kept statistics are the present's: a read at a past cut must count its own under the cut's mask +or keep them per epoch. The guard turns an older process's writes into errors, by design, and a +revert of the change needs the runbook's step to drop it, once no process of the change is left to +install it again; the statistics of a stale store wait for its reset, and the corpus's file, made +by the earlier tokenizer, must be re-derived before the +store's current tokenizer scores it. The migration holds the file's write lock for its +\migrationLex{}~s on the corpus: a writer that waits longer than the store's 30~s timeout fails, +while a reader opens at once and counts its queries' statistics from the units until the count is +done (\cref{sec:eval}). A batched landing is 7 to 11\% slower, and part of that is not attributed. +The paths shape reads every unit of every path given: a call with hundreds of thousands of paths, +which a mostly unembedded corpus would make, needs the pending set redesigned first. The corpus +holds one class, so its readers' sums are over one row; the property tests hold four. The +measurements are one run before and one after on one shared machine, the landing's after run at a +higher load; the cold behaviour of a file larger than memory was not measured. + +\section{Future work}\label{sec:future} + +The posting lists as arrays in immutable segments, with the statistics kept per class and per +segment and an exact pruned search, are the change that makes a free query's time follow the +postings it needs rather than the postings its terms hold. The pending set as a mask over one +ranking removes the paths shape's growth. The upkeep's invariant (\cref{prop:recount}) and the +clearance rule (\cref{prop:clearance}) have the shape of the store's other laws and can be stated +over a finite model and proved, beside the property tests that check them now. + +\section{Conclusion}\label{sec:conclusion} + +The two slowest reads of the corpus instance were not slow because of the data but because of +what was recomputed for each question: a document frequency counted by visiting every unit, a +ledger decoded record by record. Keeping the statistics with the writes that change them, naming +the statements' order, writing the sum out in the reference's order and indexing the ledger by +output hash make the store's own queries and the ledger's lookups cost milliseconds and a free +query about a second, with the clearance rule and the answers as they were, for 7 to 11\% more +time on a batched landing. + +\bibliographystyle{plainnat} +\bibliography{refs} +\end{document} diff --git a/papers/2026-11-11-keyword-and-ledger/refs.bib b/papers/2026-11-11-keyword-and-ledger/refs.bib new file mode 100644 index 00000000..812b7fbb --- /dev/null +++ b/papers/2026-11-11-keyword-and-ledger/refs.bib @@ -0,0 +1,101 @@ +@article{robertson2009bm25, + author = {Robertson, Stephen and Zaragoza, Hugo}, + title = {The Probabilistic Relevance Framework: {BM25} and Beyond}, + journal = {Foundations and Trends in Information Retrieval}, + year = {2009}, + doi = {10.1561/1500000019} +} + +@article{zobel2006inverted, + author = {Zobel, Justin and Moffat, Alistair}, + title = {Inverted files for text search engines}, + journal = {ACM Computing Surveys}, + volume = {38}, + number = {2}, + pages = {6}, + year = {2006}, + doi = {10.1145/1132956.1132959} +} + +@article{turtle1995query, + author = {Turtle, Howard and Flood, James}, + title = {Query evaluation: Strategies and optimizations}, + journal = {Information Processing \& Management}, + volume = {31}, + number = {6}, + pages = {831--850}, + year = {1995}, + doi = {10.1016/0306-4573(95)00020-H} +} + +@inproceedings{selinger1979access, + author = {Selinger, P. Griffiths and Astrahan, M. M. and Chamberlin, D. D. and Lorie, R. A. and Price, T. G.}, + title = {Access path selection in a relational database management system}, + booktitle = {Proceedings of the 1979 ACM SIGMOD International Conference on Management of Data}, + pages = {23}, + publisher = {ACM}, + year = {1979}, + doi = {10.1145/582095.582099} +} + +@article{kahan1965further, + author = {Kahan, W.}, + title = {Pracniques: further remarks on reducing truncation errors}, + journal = {Communications of the ACM}, + volume = {8}, + number = {1}, + pages = {40}, + year = {1965}, + doi = {10.1145/363707.363723} +} + +@article{neumaier1974rundungsfehler, + author = {Neumaier, A.}, + title = {Rundungsfehleranalyse einiger {V}erfahren zur {S}ummation endlicher {S}ummen}, + journal = {ZAMM: Zeitschrift f{\"u}r Angewandte Mathematik und Mechanik}, + volume = {54}, + number = {1}, + pages = {39--51}, + year = {1974}, + doi = {10.1002/zamm.19740540106} +} + +@article{higham1993accuracy, + author = {Higham, Nicholas J.}, + title = {The Accuracy of Floating Point Summation}, + journal = {SIAM Journal on Scientific Computing}, + volume = {14}, + number = {4}, + pages = {783--799}, + year = {1993}, + doi = {10.1137/0914050} +} + +@misc{ieee754-2019, + author = {{IEEE}}, + title = {{IEEE} Standard for Floating-Point Arithmetic ({IEEE} Std 754-2019)}, + howpublished = {IEEE}, + year = {2019}, + doi = {10.1109/IEEESTD.2019.8766229} +} + +@inproceedings{goguen1982security, + author = {Goguen, J. A. and Meseguer, J.}, + title = {Security Policies and Security Models}, + booktitle = {1982 IEEE Symposium on Security and Privacy}, + pages = {11}, + publisher = {IEEE}, + year = {1982}, + doi = {10.1109/SP.1982.10014} +} + +@article{haerder1983principles, + author = {Haerder, Theo and Reuter, Andreas}, + title = {Principles of transaction-oriented database recovery}, + journal = {ACM Computing Surveys}, + volume = {15}, + number = {4}, + pages = {287--317}, + year = {1983}, + doi = {10.1145/289.291} +} diff --git a/tests/adversarial/test_guest_lite.py b/tests/adversarial/test_guest_lite.py index 629eaa17..1e01e09a 100644 --- a/tests/adversarial/test_guest_lite.py +++ b/tests/adversarial/test_guest_lite.py @@ -248,20 +248,21 @@ def test_every_lexical_read_the_guest_causes_names_classes_its_grant_reads( from core.stores.lexical import LexicalStore asked: list[frozenset[str] | None] = [] - score, count = LexicalStore._score_units, LexicalStore.count + score, count = LexicalStore._ranked, LexicalStore.count def named(classes: Any) -> frozenset[str] | None: return None if classes is None else frozenset(str(c) for c in classes) - def scored(self: LexicalStore, query: str, *, classes: Any, paths: Any) -> dict[int, float]: + def scored(self: LexicalStore, query: str, *, classes: Any, paths: Any, k: int | None, + per_path: bool) -> list[Any]: asked.append(named(classes)) - return score(self, query, classes=classes, paths=paths) + return score(self, query, classes=classes, paths=paths, k=k, per_path=per_path) def counted(self: LexicalStore, *, classes: Any = None) -> int: asked.append(named(classes)) return count(self, classes=classes) - monkeypatch.setattr(LexicalStore, "_score_units", scored) + monkeypatch.setattr(LexicalStore, "_ranked", scored) monkeypatch.setattr(LexicalStore, "count", counted) a, _ = lite guest = _server(a, "guest") diff --git a/tests/fixtures/lexical_reference.py b/tests/fixtures/lexical_reference.py new file mode 100644 index 00000000..c4199f59 --- /dev/null +++ b/tests/fixtures/lexical_reference.py @@ -0,0 +1,191 @@ +"""The lexical index as it was before its statistics were kept (core/stores/lexical.py at +f969904e), kept as the reference the rewritten statements are tested against: the schema, the +landing and the scoring statements, their SQL verbatim, as functions of a connection (one count of +each term's document frequency and one row statement a term, scored in Python, a sort of every +scored unit). +""" + +from __future__ import annotations + +import sqlite3 +from collections import Counter +from collections.abc import Collection, Iterable, Sequence +from datetime import UTC, datetime +from typing import Any + +from core.ingest.lexical import Tokenizer, idf, tf_weight +from core.kernel.ingest.chunk import Chunk +from core.kernel.provenance import Provenance + +OLD_DDL = """ +CREATE TABLE IF NOT EXISTS units ( + unit_id INTEGER PRIMARY KEY, + source_path TEXT NOT NULL, + digest TEXT NOT NULL, + chunk_index INTEGER NOT NULL, + provenance TEXT NOT NULL, + title TEXT NOT NULL, + length INTEGER NOT NULL, + current INTEGER NOT NULL DEFAULT 0, + landed_at TEXT NOT NULL, + UNIQUE (source_path, digest, chunk_index) +); +CREATE INDEX IF NOT EXISTS units_path ON units (source_path, current); +CREATE INDEX IF NOT EXISTS units_current ON units (current, provenance); +CREATE TABLE IF NOT EXISTS postings ( + term TEXT NOT NULL, + unit_id INTEGER NOT NULL, + tf INTEGER NOT NULL, + PRIMARY KEY (term, unit_id) +) WITHOUT ROWID; +CREATE INDEX IF NOT EXISTS postings_unit ON postings (unit_id); +CREATE TABLE IF NOT EXISTS versions ( + source_path TEXT NOT NULL, + digest TEXT NOT NULL, + units INTEGER NOT NULL, + PRIMARY KEY (source_path, digest) +) WITHOUT ROWID; +CREATE TABLE IF NOT EXISTS meta (key TEXT PRIMARY KEY, value TEXT NOT NULL); +""" + + +def old_land(conn: sqlite3.Connection, tokenizer: Tokenizer, source_path: str, digest: str, + provenance: str, title: str, chunks: Sequence[Chunk]) -> None: + """One version landed as the old store landed it, in its own transaction (the connection in + autocommit mode, `isolation_level=None`).""" + conn.execute("BEGIN IMMEDIATE") + try: + if conn.execute("SELECT value FROM meta WHERE key = 'tokenizer'").fetchone() is None: + conn.execute("INSERT OR REPLACE INTO meta (key, value) VALUES ('tokenizer', ?)", + [tokenizer.identity]) + wanted = {c.index for c in chunks} + held = {int(r[0]) for r in conn.execute( + "SELECT chunk_index FROM units WHERE source_path = ? AND digest = ?", + [source_path, digest])} + if held != wanted: + for (uid,) in conn.execute( + "SELECT unit_id FROM units WHERE source_path = ? AND digest = ?", + [source_path, digest]).fetchall(): + conn.execute("DELETE FROM postings WHERE unit_id = ?", [uid]) + conn.execute("DELETE FROM units WHERE source_path = ? AND digest = ?", + [source_path, digest]) + now = datetime.now(UTC).replace(tzinfo=None).isoformat(timespec="seconds") + for c in chunks: + counts = Counter(tokenizer(c.text)) + cur = conn.execute( + "INSERT INTO units (source_path, digest, chunk_index, provenance, title, " + "length, current, landed_at) VALUES (?, ?, ?, ?, ?, ?, 0, ?)", + [source_path, digest, c.index, provenance, title, + sum(counts.values()), now]) + uid = int(cur.lastrowid or 0) + conn.executemany("INSERT INTO postings (term, unit_id, tf) VALUES (?, ?, ?)", + [(t, uid, n) for t, n in counts.items()]) + conn.execute("INSERT OR REPLACE INTO versions (source_path, digest, units) " + "VALUES (?, ?, ?)", [source_path, digest, len(wanted)]) + conn.execute("UPDATE units SET current = 0 WHERE source_path = ? AND digest <> ? " + "AND current = 1", [source_path, digest]) + conn.execute("UPDATE units SET current = 1 WHERE source_path = ? AND digest = ? " + "AND current = 0", [source_path, digest]) + conn.execute("COMMIT") + except BaseException: + conn.execute("ROLLBACK") + raise + + +def _old_class_clause(classes: Iterable[Provenance] | None) -> tuple[str, list[str]]: + if classes is None: + return "", [] + values = sorted({p.value for p in classes}) + if not values: + return " AND 0", [] + return f" AND provenance IN ({', '.join('?' for _ in values)})", values + + +def old_score_units(conn: sqlite3.Connection, tokenizer: Tokenizer, query: str, *, + classes: Iterable[Provenance] | None, + paths: Collection[str] | None) -> dict[int, float]: + """Every current unit's BM25 score, as the old `_score_units` computed it.""" + terms = sorted(set(tokenizer(query))) + cls = list(classes) if classes is not None else None + where, params = _old_class_clause(cls) + n, total = conn.execute( + f"SELECT count(*), COALESCE(sum(length), 0) FROM units WHERE current = 1{where}", + params).fetchone() + n, avgdl = int(n), (float(total) / int(n) if n else 0.0) + if n == 0 or not terms: + return {} + scores: dict[int, float] = {} + ordered = sorted(set(paths)) if paths is not None else None + path_batches: list[Sequence[str]] = ([ordered[i:i + 400] for i in range(0, len(ordered), 400)] + if ordered is not None else [()]) + for term in terms: + df = int(conn.execute( + "SELECT count(*) FROM postings p JOIN units u ON u.unit_id = p.unit_id " + f"WHERE p.term = ? AND u.current = 1{where}", [term, *params]).fetchone()[0]) + if df == 0: + continue + weight = idf(n, df) + for batch in path_batches: + extra, more = "", [] + if paths is not None: + if not batch: + continue + extra = f" AND u.source_path IN ({', '.join('?' for _ in batch)})" + more = list(batch) + for uid, tf, dl in conn.execute( + "SELECT p.unit_id, p.tf, u.length FROM postings p " + "JOIN units u ON u.unit_id = p.unit_id " + f"WHERE p.term = ? AND u.current = 1{where}{extra}", + [term, *params, *more]): + scores[int(uid)] = scores.get(int(uid), 0.0) \ + + weight * tf_weight(int(tf), int(dl), avgdl) + return scores + + +def old_search(store: Any, query: str, *, k: int = 10, + classes: Iterable[Provenance] | None = None, + paths: Collection[str] | None = None) -> list[tuple[Any, ...]]: + """The old `search`: `(source_path, digest, chunk_index, title, provenance, score)`.""" + scored = old_score_units(store._conn, store.tokenizer, query, classes=classes, paths=paths) + best = sorted(scored.items(), key=lambda kv: (-kv[1], kv[0]))[:k] + out = [] + for uid, score in best: + row = store._conn.execute("SELECT source_path, digest, chunk_index, title, provenance " + "FROM units WHERE unit_id = ?", [uid]).fetchone() + out.append((str(row[0]), str(row[1]), int(row[2]), str(row[3]), str(row[4]), + float(score))) + return out + + +def old_scores(store: Any, query: str, *, classes: Iterable[Provenance] | None = None, + paths: Collection[str] | None = None) -> dict[str, float]: + """The old `scores`: each path's best unit.""" + scored = old_score_units(store._conn, store.tokenizer, query, classes=classes, paths=paths) + out: dict[str, float] = {} + for uid in sorted(scored): + (path,) = store._conn.execute("SELECT source_path FROM units WHERE unit_id = ?", + [uid]).fetchone() + out[str(path)] = max(out.get(str(path), 0.0), scored[uid]) + return out + + +def new_search(store: Any, query: str, **kw: Any) -> list[tuple[Any, ...]]: + """The store's `search` in the reference's shape.""" + return [(h.source_path, h.digest, h.chunk_index, h.title, h.provenance, h.score) + for h in store.search(query, **kw)] + + +def recount(store: Any) -> tuple[set[tuple[Any, ...]], set[tuple[Any, ...]]]: + """Assert the statistics the store keeps equal a count from its units; return them.""" + conn = store._conn + counted = ({tuple(r) for r in conn.execute( + "SELECT provenance, count(*), sum(length) FROM units WHERE current = 1 " + "GROUP BY provenance")}, + {tuple(r) for r in conn.execute( + "SELECT p.term, u.provenance, count(*) FROM postings p " + "JOIN units u ON u.unit_id = p.unit_id WHERE u.current = 1 " + "GROUP BY p.term, u.provenance")}) + kept = ({tuple(r) for r in conn.execute("SELECT provenance, units, tokens FROM class_stats")}, + {tuple(r) for r in conn.execute("SELECT term, provenance, df FROM term_stats")}) + assert kept == counted, (kept, counted) + return kept diff --git a/tests/property/test_ledger_outputs.py b/tests/property/test_ledger_outputs.py new file mode 100644 index 00000000..dbf18439 --- /dev/null +++ b/tests/property/test_ledger_outputs.py @@ -0,0 +1,309 @@ +"""The attestation ledger's output-hash table (core/attestation/store.py). + +The producer lookups read a side table, one row for each element of each record's +`output_hashes`, written by a trigger on the ledger. Laws, over generated ledgers (records sharing +hashes, naming a hash twice, naming none, appended twice, appended in a deferred block that +commits or dies): + +1. after any sequence of appends the table is a scan of the ledger, element for element; +2. each of the four lookups answers what the scan answers: `producers_of`, `producers_by_output` + (against the json_each statement it replaced, kept here with its temporary table renamed and + a commit added, since the original left its transaction open), and `attested_by` and + `already_attested` through `core/ingest/landing.py` (against the same functions over a store + that has only the scan); +3. a ledger the old code wrote gets the table on its first open, and from then on every append, + by this class or by any other writer of the table, writes its rows in its own statement; +4. a ledger the old code wrote, opened while another connection holds its write lock, by a + process that cannot write it, or when it is full, opens at once and answers every lookup from + the records, as the old code did, until the table exists. +""" + +from __future__ import annotations + +import json +import sqlite3 +import tempfile +from pathlib import Path +from typing import Any + +import pytest +from hypothesis import HealthCheck, given, settings +from hypothesis import strategies as st + +from core.attestation import Attestation, AttestationStore, StoreAttestor +from core.ingest.landing import already_attested, attested_batch, attested_by + +HASHES = [f"h{i}" for i in range(6)] +ACTIONS = ["capture", "ingest_note", "dream_pass"] + +record = st.tuples(st.sampled_from(ACTIONS), st.lists(st.sampled_from(HASHES), max_size=4), + st.lists(st.sampled_from(HASHES), max_size=2), st.integers(0, 3)) +step = st.one_of(st.tuples(st.just("append"), record), + st.tuples(st.just("again")), + st.tuples(st.just("deferred"), st.lists(record, min_size=1, max_size=3), + st.booleans())) +SETTINGS = settings(deadline=None, max_examples=80, + suppress_health_check=[HealthCheck.too_slow, HealthCheck.data_too_large]) + + +def _att(action: str, outputs: list[str], inputs: list[str], stamp: int) -> Attestation: + return Attestation.create(timestamp=f"2026-11-11T00:00:0{stamp}", agent_role="role", + action=action, constitution_fingerprint="F", + input_hashes=inputs, output_hashes=outputs) + + +def run(store: AttestationStore, steps: list[Any]) -> None: + last: Attestation | None = None + for s in steps: + if s[0] == "append": + last = store.append(_att(*s[1])) + elif s[0] == "again" and last is not None: + store.append(last) # a re-emission: a no-op + elif s[0] == "deferred": + _, records, dies = s + try: + with store.deferred(): + for r in records: + last = store.append(_att(*r)) + if dies: + raise RuntimeError("the block dies before its commit") + except RuntimeError: + last = None + + +def scan(store: AttestationStore) -> set[tuple[str, str, str, int]]: + return {(h, a.id, a.action, pos) for a in store.all() for pos, h in + enumerate(a.output_hashes)} + + +def table(store: AttestationStore) -> set[tuple[str, str, str, int]]: + return {(str(h), str(i), str(a), int(p)) for h, i, a, p in store._conn.execute( + "SELECT hash, att_id, action, pos FROM output_hashes")} + + +def old_producers_by_output(store: AttestationStore, + hashes: set[str]) -> dict[str, list[tuple[str, str]]]: + """The statement the table replaced: one json_each pass over every record (its temporary + table renamed, and committed, which the original was not).""" + out: dict[str, list[tuple[str, str]]] = {h: [] for h in hashes} + if not hashes: + return out + conn = store._conn + conn.execute("CREATE TEMP TABLE IF NOT EXISTS wanted_old (h TEXT PRIMARY KEY)") + conn.execute("DELETE FROM wanted_old") + conn.executemany("INSERT OR IGNORE INTO wanted_old VALUES (?)", [(h,) for h in hashes]) + rows = conn.execute("SELECT j.value, a.action, a.id FROM attestations a, " + "json_each(a.payload_json, '$.output_hashes') j " + "WHERE j.value IN (SELECT h FROM wanted_old)").fetchall() + conn.execute("DELETE FROM wanted_old") + conn.commit() + for h, action, att_id in rows: + out[str(h)].append((str(action), str(att_id))) + return {h: sorted(ps) for h, ps in out.items()} + + +class ScanOnly: + """A ledger with the old lookups alone: the producers by a decode of every record.""" + + def __init__(self, store: AttestationStore) -> None: + self.store = store + + def producers_of(self, hashes: set[str]) -> set[str]: + return {a.id for a in self.store.all() if hashes & set(a.output_hashes)} + + def get(self, att_id: str) -> Attestation | None: + return self.store.get(att_id) + + +def assert_lookups_agree(store: AttestationStore) -> None: + new = StoreAttestor(store) + old: Any = type("A", (), {"store": ScanOnly(store)})() + for size in (0, 1, 2, 3): + for i in range(len(HASHES) - size + 1): + hs = set(HASHES[i:i + size]) | ({"absent"} if size == 3 else set()) + assert store.producers_of(hs) == ScanOnly(store).producers_of(hs) + assert store.producers_by_output(hs) == old_producers_by_output(store, hs) + assert attested_batch(new, hs) == old_producers_by_output(store, hs) + for h in [*HASHES, "absent", ""]: + for action in ACTIONS: + assert attested_by(new, action, h) == attested_by(old, action, h) + assert already_attested(new, action, h) == already_attested(old, action, h) + + +@SETTINGS +@given(steps=st.lists(step, min_size=1, max_size=10)) +def test_the_table_is_a_scan_of_the_ledger_and_the_lookups_agree(steps: list[Any]) -> None: + with tempfile.TemporaryDirectory() as d: + store = AttestationStore(Path(d) / "att.sqlite") + run(store, steps) + assert table(store) == scan(store) + assert_lookups_agree(store) + store.close() + + +_OLD_DDL = """ +CREATE TABLE IF NOT EXISTS attestations ( + id TEXT PRIMARY KEY, + timestamp TEXT NOT NULL, + agent_role TEXT NOT NULL, + action TEXT NOT NULL, + payload_json TEXT NOT NULL, + signature TEXT NOT NULL, + signer TEXT NOT NULL +); +CREATE INDEX IF NOT EXISTS att_role_ts ON attestations(agent_role, timestamp); +""" + + +def _old_append(conn: sqlite3.Connection, att: Attestation) -> None: + """An append as the code before the table made it (and as any other writer of the table).""" + conn.execute("INSERT OR IGNORE INTO attestations VALUES (?, ?, ?, ?, ?, ?, ?)", + [att.id, att.timestamp, att.agent_role, att.action, + json.dumps(att.to_dict(), separators=(",", ":")), att.signature, att.signer]) + conn.commit() + + +@SETTINGS +@given(records=st.lists(record, max_size=8), later=st.lists(record, max_size=4)) +def test_a_ledger_the_old_code_wrote_gets_its_table_on_first_open(records: list[Any], + later: list[Any]) -> None: + with tempfile.TemporaryDirectory() as d: + path = Path(d) / "att.sqlite" + conn = sqlite3.connect(str(path)) + conn.executescript(_OLD_DDL) + for r in records: + _old_append(conn, _att(*r)) + conn.close() + store = AttestationStore(path) # the migration + assert table(store) == scan(store) + assert_lookups_agree(store) + raw = sqlite3.connect(str(path)) + for r in later: # a writer of the table alone + _old_append(raw, _att(*r)) + raw.close() + assert table(store) == scan(store) + assert_lookups_agree(store) + store.close() + + +def test_an_append_that_dies_leaves_neither_its_record_nor_its_rows(tmp_path: Path) -> None: + store = AttestationStore(tmp_path / "att.sqlite") + kept = store.append(_att("capture", ["h1"], ["h1"], 0)) + with pytest.raises(RuntimeError), store.deferred(): + store.append(_att("capture", ["h2", "h2"], ["h2"], 1)) + raise RuntimeError("died after the record, before the commit") + assert {a.id for a in store.all()} == {kept.id} + assert table(store) == {("h1", kept.id, "capture", 0)} + assert store.producers_of({"h2"}) == set() + + +def test_a_record_that_names_a_hash_twice_is_its_producer_once_and_listed_twice( + tmp_path: Path) -> None: + store = AttestationStore(tmp_path / "att.sqlite") + a = store.append(_att("capture", ["h1", "h1"], ["h1"], 0)) + assert store.producers_of({"h1"}) == {a.id} + assert store.producers_by_output({"h1"}) == {"h1": [("capture", a.id), ("capture", a.id)]} + assert attested_by(StoreAttestor(store), "capture", "h1") == [a.id] + assert store.producers_by_output({"h1"}) == old_producers_by_output(store, {"h1"}) + + +def test_the_lookup_is_a_seek_of_the_table(tmp_path: Path) -> None: + store = AttestationStore(tmp_path / "att.sqlite") + plan = " ".join(str(r[3]) for r in store._conn.execute( + "EXPLAIN QUERY PLAN SELECT att_id FROM output_hashes WHERE hash IN (?)", ["h"])) + assert "SEARCH output_hashes USING PRIMARY KEY (hash=?)" in plan + + +def _old_ledger(path: Path, records: list[Any]) -> list[Attestation]: + conn = sqlite3.connect(str(path)) + conn.executescript(_OLD_DDL) + atts = [_att(*r) for r in records] + for a in atts: + _old_append(conn, a) + conn.close() + return atts + + +OLD = [("capture", ["h1", "h2"], ["h1"], 0), ("capture", ["h2", "h2"], ["h2"], 1), + ("ingest_note", ["h3"], ["h1", "h3"], 2), ("dream_pass", [], ["h4"], 3)] + + +def test_a_ledger_opened_while_another_holds_its_lock_answers_from_the_records( + tmp_path: Path) -> None: + """The migration does not wait for the lock: the ledger opens at once, the lookups pass over + the records (also inside a deferred block, whose own appends they see), and the first lookup + after the lock is free, outside a transaction, makes the table.""" + import time + + path = tmp_path / "att.sqlite" + _old_ledger(path, OLD) + raw = sqlite3.connect(str(path), isolation_level=None) + raw.execute("BEGIN IMMEDIATE") # another connection's write lock + t0 = time.perf_counter() + store = AttestationStore(path) + assert time.perf_counter() - t0 < 2 and not store._has_outputs() + assert_lookups_agree(store) + raw.execute("ROLLBACK") + raw.close() + with store.deferred(): + new = store.append(_att("capture", ["h5"], ["h5"], 3)) + assert store.producers_of({"h5"}) == {new.id} # the block's own append, by the scan + assert not store._has_outputs() # not made inside the block + assert store.producers_by_output({"h5"}) == {"h5": [("capture", new.id)]} + assert store._has_outputs() and table(store) == scan(store) + assert_lookups_agree(store) + store.close() + + +def test_a_ledger_this_process_cannot_write_opens_and_answers_from_the_records( + tmp_path: Path) -> None: + import os + import stat + + path = tmp_path / "att.sqlite" + atts = _old_ledger(path, OLD) + os.chmod(path, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH) + try: + store = AttestationStore(path) + assert not store._has_outputs() + assert store.producers_of({"h2"}) == {atts[0].id, atts[1].id} + assert_lookups_agree(store) + store.close() + finally: + os.chmod(path, stat.S_IRUSR | stat.S_IWUSR) + + +def test_a_ledger_whose_migration_fails_opens_and_answers_from_the_records( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: + """A full file (SQLite refuses its next page, as a full disk refuses a write): the migration + is rolled back, the ledger opens and answers every lookup from the records, as the old code + did, and does not try the migration again until it is opened again; an append fails, as any + write to a full file does. The next open makes the table.""" + path = tmp_path / "att.sqlite" + atts = _old_ledger(path, OLD) + connect = sqlite3.connect + + def full(*args: Any, **kwargs: Any) -> sqlite3.Connection: + conn = connect(*args, **kwargs) + (pages,) = conn.execute("PRAGMA page_count").fetchone() + conn.execute(f"PRAGMA max_page_count = {pages}") # not one page more + return conn + + monkeypatch.setattr(sqlite3, "connect", full) + store = AttestationStore(path) + assert not store._has_outputs() and not store._conn.in_transaction + ran: list[str] = [] + store._conn.set_trace_callback(ran.append) + assert store.producers_of({"h2"}) == {atts[0].id, atts[1].id} + assert_lookups_agree(store) + assert not any("BEGIN IMMEDIATE" in s for s in ran) # not tried again + store._conn.set_trace_callback(None) + with pytest.raises(sqlite3.OperationalError, match="full"): + store.append(_att("capture", [f"x{i}" for i in range(2000)], ["h1"], 0)) + assert not store._has_outputs() and store.count() == len(OLD) + store.close() + monkeypatch.undo() + again = AttestationStore(path) + assert again._has_outputs() and table(again) == scan(again) + assert_lookups_agree(again) + again.close() diff --git a/tests/property/test_lexical_statistics.py b/tests/property/test_lexical_statistics.py new file mode 100644 index 00000000..e53a4f1b --- /dev/null +++ b/tests/property/test_lexical_statistics.py @@ -0,0 +1,279 @@ +"""The lexical index's statements and its kept statistics (core/stores/lexical.py). + +The keyword statements start from the query terms' postings (or from the given paths' units), +read the unit count, the mean length and the document frequencies from per-class tables that +every write changing which units are current keeps in its own transaction, and compute the +arithmetic, the sum over the terms and the top k in one statement. Three laws, over generated +stores (several classes, three tokenizers, ties, empty and absent classes, paths given and not): + +1. the ranking is the old statements' to the bit: the same units in the same order with the same + scores, for `search` and `scores`, every shape a caller uses (the old statements are kept, + verbatim from the store before the change, in `tests/fixtures/lexical_reference.py`); +2. after any sequence of landings, re-landings, batched landings (one transaction landing a path + more than once), retires and re-derivations, the stored statistics equal a recount from the + units; +3. a reader's statistics, and so its scores, are a function of its cleared classes' units alone: + a store that also holds other classes' units, landed and retired around the cleared ones, + answers the reader exactly as a store holding the cleared units alone. + +A control shows the first law has teeth: SQLite's `sum()` compensates its rounding, so a sum +taken by it differs from the reference's left-to-right sum, which the statement writes out. +""" + +from __future__ import annotations + +import sqlite3 +import tempfile +from collections.abc import Iterable, Sequence +from pathlib import Path +from typing import Any + +from hypothesis import HealthCheck, given, settings +from hypothesis import strategies as st + +from core.ingest.lexical import LEGACY, TOKENIZER, Tokenizer +from core.kernel.ingest.chunk import Chunk +from core.kernel.provenance import Provenance +from core.stores.lexical import LexicalStore +from tests.fixtures.lexical_reference import new_search, old_scores, old_search, recount + +CLASSES = [Provenance.AUTHORED_SOLO, Provenance.OBSERVED, Provenance.CURATED, + Provenance.AUTHORED_DIALOGUE] +TOKENIZERS = [TOKENIZER, LEGACY, Tokenizer("NFC", "lower", False)] +# a small vocabulary, so units share terms and scores tie; forms that tokenizers tell apart +WORDS = ["graph", "Graph", "spectral", "gap", "random", "walk", "the", "of", "café", "café", + "Straße", "strasse", "financial", "x²", "x2"] +PATHS = [f"p{i}" for i in range(6)] + +text = st.lists(st.sampled_from(WORDS), min_size=0, max_size=7).map(" ".join) +chunks = st.lists(text, min_size=0, max_size=3) +land = st.tuples(st.just("land"), st.sampled_from(PATHS), st.sampled_from(["v0", "v1", "v2"]), + st.sampled_from(CLASSES), chunks) +# one transaction of several versions, a path and a digest drawn again and again among them, so a +# unit's currency can move more than once before the batch's statistics move (`land_many`) +item = st.tuples(st.sampled_from(PATHS[:3]), st.sampled_from(["v0", "v1"]), + st.sampled_from(CLASSES), chunks) +batch = st.tuples(st.just("batch"), st.lists(item, min_size=1, max_size=6)) +retire = st.tuples(st.just("retire"), st.sampled_from(PATHS)) +rederive = st.tuples(st.just("rederive")) +ops = st.lists(st.one_of(land, land, land, batch, retire, rederive), min_size=1, max_size=14) +query = st.lists(st.sampled_from([*WORDS, "absent", "nowhere"]), min_size=0, max_size=5).map( + " ".join) +classes = st.one_of(st.none(), st.lists(st.sampled_from(CLASSES), max_size=3)) +paths = st.one_of(st.none(), st.lists(st.sampled_from([*PATHS, "nope"]), max_size=4)) +asks = st.lists(st.tuples(query, classes, paths, st.sampled_from([1, 2, 3, 10, 0, -1])), + min_size=1, max_size=6) +SETTINGS = settings(deadline=None, max_examples=60, + suppress_health_check=[HealthCheck.too_slow, HealthCheck.data_too_large]) + + +def _chunks(texts: Sequence[str]) -> list[Chunk]: + return [Chunk(i, t) for i, t in enumerate(texts)] + + +def apply(store: LexicalStore, steps: Iterable[tuple[Any, ...]], + active: dict[str, tuple[str, str, list[str]]], + after: Any = None) -> None: + """Run the operations; `active` follows what a catalog would hold (the re-derivation lands + it again, as `derive.derive_lexical` lands every active item).""" + for step in steps: + if step[0] == "land": + _, path, digest, klass, texts = step + store.land(source_path=path, digest=digest, provenance=klass.value, title=path, + chunks=_chunks(texts)) + active[path] = (digest, klass.value, list(texts)) + elif step[0] == "batch": + store.land_many([(p, d, k.value, p, _chunks(t)) for p, d, k, t in step[1]]) + for p, d, k, t in step[1]: # the batch's last version of a path is current + active[p] = (d, k.value, list(t)) + elif step[0] == "retire": + store.retire(step[1]) + active.pop(step[1], None) + else: + store.reset() + store.land_many([(p, d, c, p, _chunks(t)) for p, (d, c, t) in sorted(active.items())]) + if after is not None: + after(store) + + +# ── 1. the ranking is the old statements', to the bit ───────────────────────────────────────── + +@SETTINGS +@given(tok=st.sampled_from(TOKENIZERS), steps=ops, asked=asks) +def test_the_statements_rank_as_the_old_ones_to_the_bit(tok: Tokenizer, steps: list[Any], + asked: list[Any]) -> None: + with tempfile.TemporaryDirectory() as d: + store = LexicalStore(Path(d) / "lex.sqlite", tokenizer=tok) + apply(store, steps, {}) + for q, cls, ps, k in asked: + assert new_search(store, q, k=k, classes=cls, paths=ps) == \ + old_search(store, q, k=k, classes=cls, paths=ps) + assert store.scores(q, classes=cls, paths=ps) == old_scores(store, q, classes=cls, + paths=ps) + store.close() + + +@SETTINGS +@given(tok=st.sampled_from(TOKENIZERS), steps=ops, asked=asks) +def test_a_query_past_the_written_sums_length_ranks_as_the_old_ones_too( + tok: Tokenizer, steps: list[Any], asked: list[Any]) -> None: + """A query of more terms than one written-out sum takes (`_SUM_TERMS`, here lowered to one so + generated queries reach it) has its weights summed outside the statement, in the same order: + the same law.""" + import core.stores.lexical as module + + limit = module._SUM_TERMS + module._SUM_TERMS = 1 + try: + with tempfile.TemporaryDirectory() as d: + store = LexicalStore(Path(d) / "lex.sqlite", tokenizer=tok) + apply(store, steps, {}) + for q, cls, ps, k in asked: + assert new_search(store, q, k=k, classes=cls, paths=ps) == \ + old_search(store, q, k=k, classes=cls, paths=ps) + assert store.scores(q, classes=cls, paths=ps) == \ + old_scores(store, q, classes=cls, paths=ps) + store.close() + finally: + module._SUM_TERMS = limit + + +def test_a_query_of_more_terms_than_sqlite_parses_in_one_sum(tmp_path: Path) -> None: + store = LexicalStore(tmp_path / "lex.sqlite") + words = [f"w{i}" for i in range(1200)] + store.land(source_path="a", digest="v", provenance=Provenance.OBSERVED.value, title="a", + chunks=_chunks([" ".join(words[:700]), " ".join(words[500:])])) + store.land(source_path="b", digest="v", provenance=Provenance.CURATED.value, title="b", + chunks=_chunks([" ".join(words[::3])])) + for n in (499, 500, 501, 1200): + q = " ".join(words[:n]) + for cls in (None, [Provenance.OBSERVED]): + assert new_search(store, q, k=3, classes=cls) == old_search(store, q, k=3, + classes=cls) + assert store.scores(q, classes=cls, paths=["a", "b"]) == \ + old_scores(store, q, classes=cls, paths=["a", "b"]) + + +def test_ties_are_broken_by_unit_id_and_scores_are_equal_bit_for_bit(tmp_path: Path) -> None: + store = LexicalStore(tmp_path / "lex.sqlite") + for i in range(12): # identical units: every score ties + store.land(source_path=f"t{i:02d}", digest="v", provenance=Provenance.OBSERVED.value, + title="t", chunks=_chunks(["spectral gap of a random graph"])) + store.land(source_path="u", digest="v", provenance=Provenance.CURATED.value, title="u", + chunks=_chunks(["spectral spectral gap", "graph"])) + for q in ("spectral gap", "random graph gap", "graph"): + for cls in (None, [Provenance.OBSERVED], [Provenance.CURATED, Provenance.OBSERVED]): + got, want = new_search(store, q, k=5, classes=cls), old_search(store, q, k=5, + classes=cls) + assert got == want + assert [s.hex() for *_, s in got] == [s.hex() for *_, s in want] + assert [h.source_path for h in store.search("graph", k=3, + classes=[Provenance.OBSERVED])] == \ + ["t00", "t01", "t02"] + + +def test_sqlites_own_sum_is_not_the_reference_sum_the_control() -> None: + """Why the statement writes the sum out: `sum()` compensates its rounding (Kahan, Babuska and + Neumaier), so over the same values in the same order it can give another double than the + reference loop's left-to-right sum, which the written-out sum reproduces.""" + values = [1.0, 2.0 ** -53, 2.0 ** -53] + reference = 0.0 + for v in values: + reference += v + conn = sqlite3.connect(":memory:") + conn.execute("CREATE TABLE r (i INTEGER PRIMARY KEY, c REAL)") + conn.executemany("INSERT INTO r VALUES (?, ?)", list(enumerate(values))) + (compensated,) = conn.execute("SELECT sum(c) FROM (SELECT c FROM r ORDER BY i)").fetchone() + (written,) = conn.execute( + "SELECT " + " + ".join(f"COALESCE(max(c) FILTER (WHERE i = {i}), 0.0)" + for i in range(len(values))) + " FROM r").fetchone() + assert compensated != reference and written == reference + + +# ── 2. the stored statistics are a recount of the units ─────────────────────────────────────── + +@SETTINGS +@given(tok=st.sampled_from(TOKENIZERS), steps=ops) +def test_the_statistics_equal_a_recount_after_any_sequence(tok: Tokenizer, + steps: list[Any]) -> None: + with tempfile.TemporaryDirectory() as d: + store = LexicalStore(Path(d) / "lex.sqlite", tokenizer=tok) + apply(store, steps, {}, after=recount) + store.close() + again = LexicalStore(Path(d) / "lex.sqlite", tokenizer=tok) # reopened: kept, not redone + recount(again) + again.close() + + +def test_a_relanding_with_other_chunks_moves_the_statistics_before_its_postings_go( + tmp_path: Path) -> None: + """A version landed again with other chunks deletes its units and their postings; units that + were current leave the statistics while their postings still exist.""" + store = LexicalStore(tmp_path / "lex.sqlite") + store.land(source_path="a", digest="v", provenance=Provenance.OBSERVED.value, title="a", + chunks=_chunks(["alpha beta", "gamma"])) + recount(store) + store.land(source_path="a", digest="v", provenance=Provenance.OBSERVED.value, title="a", + chunks=_chunks(["delta"])) + classes, terms = recount(store) + assert terms == {("delta", Provenance.OBSERVED.value, 1)} + # within one batch: made current, then rewritten, then superseded, then made current again + store.land_many([("b", "v", Provenance.CURATED.value, "b", _chunks(["x y"])), + ("b", "v", Provenance.CURATED.value, "b", _chunks(["x", "z"])), + ("b", "w", Provenance.CURATED.value, "b", _chunks(["y"])), + ("b", "v", Provenance.CURATED.value, "b", _chunks(["x", "z"]))]) + recount(store) + assert store.statistics(classes=[Provenance.CURATED], terms=["x", "y", "z"]).df == \ + {"x": 1, "z": 1} + + +# ── 3. a reader's statistics are its cleared classes' own ───────────────────────────────────── + +@SETTINGS +@given(tok=st.sampled_from(TOKENIZERS), steps=ops, + cleared=st.lists(st.sampled_from(CLASSES), min_size=1, max_size=2, unique=True), + asked=st.lists(query, min_size=1, max_size=4)) +def test_a_readers_statistics_ignore_the_classes_it_is_not_cleared_for( + tok: Tokenizer, steps: list[Any], cleared: list[Provenance], asked: list[str]) -> None: + """Store `a` takes every operation; store `b` only those on the cleared classes' items (and + the re-derivations). After every step a reader cleared for those classes sees the same + statistics in both, and so the same scores and the same ranking.""" + def mine(step: tuple[Any, ...]) -> tuple[Any, ...] | None: + """The step as store `b` takes it: the cleared classes' items alone, or nothing.""" + if step[0] == "land": + return step if step[3] in cleared else None + if step[0] == "batch": + items = [i for i in step[1] if i[2] in cleared] + return ("batch", items) if items else None + if step[0] == "retire" and first.get(step[1]) not in cleared: + return None + return step + # a path keeps its class, as the catalog keeps an item's label (ING-17) + first: dict[str, Provenance] = {} + fixed = [] + for step in steps: + if step[0] == "land": + klass = first.setdefault(step[1], step[3]) + step = (*step[:3], klass, step[4]) + elif step[0] == "batch": + step = ("batch", [(p, d, first.setdefault(p, k), t) for p, d, k, t in step[1]]) + fixed.append(step) + vocabulary = sorted({t for w in WORDS for t in tok(w)}) + with tempfile.TemporaryDirectory() as d: + a = LexicalStore(Path(d) / "a.sqlite", tokenizer=tok) + b = LexicalStore(Path(d) / "b.sqlite", tokenizer=tok) + active_a: dict[str, tuple[str, str, list[str]]] = {} + active_b: dict[str, tuple[str, str, list[str]]] = {} + for step in fixed: + apply(a, [step], active_a) + theirs = mine(step) + if theirs is not None: + apply(b, [theirs], active_b) + assert a.statistics(classes=cleared, terms=vocabulary) == \ + b.statistics(classes=cleared, terms=vocabulary) + for q in asked: + assert a.scores(q, classes=cleared) == b.scores(q, classes=cleared) + assert new_search(a, q, k=10, classes=cleared) == \ + new_search(b, q, k=10, classes=cleared) + a.close() + b.close() diff --git a/tests/unit/test_lexical_index.py b/tests/unit/test_lexical_index.py index 707e4dc1..b81e57d4 100644 --- a/tests/unit/test_lexical_index.py +++ b/tests/unit/test_lexical_index.py @@ -357,3 +357,357 @@ def test_a_store_from_before_the_record_holds_legacy_units(tmp_path: Path): assert LexicalStore(tmp_path / "lex.sqlite", tokenizer=Tokenizer()).stale empty = LexicalStore(tmp_path / "empty.sqlite", tokenizer=Tokenizer()) assert empty.recorded_tokenizer() is None and not empty.stale + + +# ── the kept statistics: the migration, the guards, a transaction that dies ──────────────────── + +def _old_store(path: Path, tokenizer: Tokenizer, *, record: bool = True) -> None: + """A store written by the code before the statistics existed (its schema and its landing, + `tests/fixtures/lexical_reference.py`), with a retire as that code retired a path.""" + import sqlite3 + + from tests.fixtures.lexical_reference import OLD_DDL, old_land + + conn = sqlite3.connect(str(path), isolation_level=None) + conn.execute("PRAGMA journal_mode=WAL") # as the old store opened its file + conn.executescript(OLD_DDL) + for p, d, cls, texts in (("a.md", "v1", AUTHORED, ["spectral gap of a graph", "random"]), + ("b.md", "v1", OBSERVED, ["random walks on graphs"]), + ("a.md", "v2", AUTHORED, ["spectral gap"]), + ("c.md", "v1", OBSERVED, ["the gap between two numbers"]), + ("d.md", "v1", AUTHORED, ["nothing relevant"])): + old_land(conn, tokenizer, p, d, cls, p, _chunks(*texts)) + conn.execute("UPDATE units SET current = 0 WHERE source_path = 'd.md' AND current = 1") + if not record: + conn.execute("DELETE FROM meta") + conn.close() + + +def test_a_store_from_before_the_statistics_counts_them_on_its_first_open(tmp_path: Path): + from tests.fixtures.lexical_reference import new_search, old_search, recount + + path = tmp_path / "lex.sqlite" + _old_store(path, TOKENIZER) + store = LexicalStore(path) + classes, terms = recount(store) + assert classes == {(AUTHORED, 1, 2), (OBSERVED, 2, 9)} + assert ("gap", OBSERVED, 1) in terms and ("gap", AUTHORED, 1) in terms + for q in ("spectral gap", "random graphs", "the gap", "absent"): + for cls in (None, [Provenance.OBSERVED], [Provenance.AUTHORED_SOLO]): + assert new_search(store, q, k=10, classes=cls) == old_search(store, q, k=10, + classes=cls) + store.close() + again = LexicalStore(path) # counted once: a second open counts nothing + assert again.statistics().units == 3 and again.statistics(terms=["gap"]).df == {"gap": 2} + + +def test_a_stale_store_is_counted_by_its_reset_not_by_its_open(tmp_path: Path): + import sqlite3 + + path = tmp_path / "lex.sqlite" + _old_store(path, LEGACY, record=False) # LEGACY's units, from before the record + store = LexicalStore(path) # the current tokenizer: stale + assert store.stale and not store._counted() + assert store._conn.execute("SELECT 1 FROM sqlite_master WHERE name = 'class_stats'" + ).fetchone() is None # its open wrote nothing + raw = sqlite3.connect(str(path), isolation_level=None) + raw.execute("UPDATE units SET current = 1 WHERE source_path = 'd.md'") # nothing guards it + raw.close() + store.reset() + store.land(source_path="a.md", digest="v3", provenance=AUTHORED, title="A", + chunks=_chunks("Straße und Weg")) + from tests.fixtures.lexical_reference import recount + + assert recount(store)[0] == {(AUTHORED, 1, 3)} + assert "a.md" in store.scores("strasse") + + +def test_the_units_refuse_a_write_that_does_not_keep_the_statistics(tmp_path: Path): + """A process of the code before the statistics (or any writer but this class) would change + which units are current without moving the statistics; the units refuse it, whole.""" + import sqlite3 + + from tests.fixtures.lexical_reference import old_land, recount + + path = tmp_path / "lex.sqlite" + store = LexicalStore(path) + store.land(source_path="a.md", digest="v1", provenance=AUTHORED, title="A", + chunks=_chunks("alpha beta", "gamma")) + kept = recount(store) + raw = sqlite3.connect(str(path), isolation_level=None) + for sql in ("UPDATE units SET current = 0 WHERE source_path = 'a.md'", + "DELETE FROM units WHERE source_path = 'a.md'", + "INSERT INTO units (source_path, digest, chunk_index, provenance, title, length, " + "current, landed_at) VALUES ('b.md', 'v', 0, 'observed', 'B', 1, 1, 'now')"): + with pytest.raises(sqlite3.IntegrityError, match="keeps statistics"): + raw.execute(sql) + with pytest.raises(sqlite3.IntegrityError): + old_land(raw, store.tokenizer, "b.md", "v1", OBSERVED, "B", _chunks("beta")) + raw.close() + assert recount(store) == kept and store.units_of("b.md", current=False) == 0 + assert store.retire("a.md") == 2 and recount(store) == (set(), set()) + + +def test_a_transaction_that_dies_between_the_units_and_the_statistics_leaves_neither( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch): + """The statistics move once a transaction, after every unit row of it is written (a retire's + after its currency moved): an exception there leaves neither the rows nor the statistics.""" + from tests.fixtures.lexical_reference import recount + + store = LexicalStore(tmp_path / "lex.sqlite") + store.land(source_path="a.md", digest="v1", provenance=AUTHORED, title="A", + chunks=_chunks("alpha beta")) + kept = recount(store) + keep, seen = LexicalStore._keep, [] + + def dying(self: LexicalStore, changes: dict[int, int]) -> None: + if not changes: # a version's own call, before its rows: nothing moves + keep(self, changes) + return + seen.append(self._conn.execute( + "SELECT (SELECT count(*) FROM units WHERE source_path = 'b.md'), " + "(SELECT count(*) FROM units WHERE source_path = 'a.md' AND current = 1)").fetchone()) + raise RuntimeError("died after the unit rows, before the statistics") + monkeypatch.setattr(LexicalStore, "_keep", dying) + with pytest.raises(RuntimeError): + store.land_many([("b.md", "v1", OBSERVED, "B", _chunks("beta gamma")), + ("a.md", "v2", AUTHORED, "A", _chunks("delta"))]) + with pytest.raises(RuntimeError): + store.retire("a.md") + monkeypatch.undo() + # the batch died with b.md's unit written and a.md's new version current; the retire with + # a.md's units no longer current + assert seen == [(1, 1), (0, 0)] + assert recount(store) == kept + assert store.units_of("b.md", current=False) == 0 and store.holds_current("a.md", "v1") + assert store.landed_versions() == {("a.md", "v1")} + + +def test_a_write_killed_before_its_commit_leaves_neither(tmp_path: Path): + """The process dies (no exception, no rollback) at the statistics, after the unit rows: a + landing with its units written and made current, a retire with its currency moved. The + uncommitted transaction is gone when the store is opened again.""" + import subprocess + import sys + + from tests.fixtures.lexical_reference import recount + + path = tmp_path / "lex.sqlite" + store = LexicalStore(path) + store.land(source_path="a.md", digest="v1", provenance=AUTHORED, title="A", + chunks=_chunks("alpha beta")) + kept = recount(store) + store.close() + script = ( + "import os, sys\n" + "from pathlib import Path\n" + "from core.kernel.ingest.chunk import Chunk\n" + "from core.stores.lexical import LexicalStore\n" + "keep = LexicalStore._keep\n" + "def dying(self, changes):\n" + " if not changes:\n" + " return keep(self, changes)\n" + " row = self._conn.execute(\"SELECT (SELECT count(*) FROM units WHERE current = 1 \"\n" + " \"AND source_path = 'b.md'), (SELECT count(*) FROM units \"\n" + " \"WHERE current = 1 AND source_path = 'a.md')\").fetchone()\n" + " print(*row, flush=True)\n" + " os._exit(9)\n" + "LexicalStore._keep = dying\n" + "s = LexicalStore(Path(sys.argv[1]))\n" + "if sys.argv[2] == 'land':\n" + " s.land_many([('b.md', 'v1', 'observed', 'B', [Chunk(0, 'beta gamma')])])\n" + "else:\n" + " s.retire('a.md')\n") + for write, inside in (("land", "1 1"), ("retire", "0 0")): + done = subprocess.run([sys.executable, "-c", script, str(path), write], + capture_output=True, text=True) + assert done.returncode == 9, done.stderr + assert done.stdout.split() == inside.split() # it died with its rows written + again = LexicalStore(path) + assert recount(again) == kept and again.units_of("b.md", current=False) == 0 + assert again.holds_current("a.md", "v1") + again.close() + + +def test_a_write_whose_writer_key_fails_leaves_no_transaction_open(tmp_path: Path): + """The writer's key is the transaction's first write: when it fails (here a trigger refuses + it, as a full disk would), the transaction is rolled back, the write lock is free for other + connections, and the store's next write begins its own.""" + import sqlite3 + + from tests.fixtures.lexical_reference import recount + + path = tmp_path / "lex.sqlite" + store = LexicalStore(path) + store.land(source_path="a.md", digest="v1", provenance=AUTHORED, title="A", + chunks=_chunks("alpha beta")) + kept = recount(store) + raw = sqlite3.connect(str(path), isolation_level=None) + raw.execute("CREATE TRIGGER refuse_writer BEFORE INSERT ON meta WHEN NEW.key = 'writer' " + "BEGIN SELECT RAISE(ABORT, 'no room for the key'); END") + for write in (lambda: store.retire("a.md"), store.reset, + lambda: store.land(source_path="b.md", digest="v1", provenance=OBSERVED, + title="B", chunks=_chunks("beta"))): + with pytest.raises(sqlite3.IntegrityError, match="no room"): + write() + assert not store._conn.in_transaction + raw.execute("BEGIN IMMEDIATE") # the lock is free + raw.execute("ROLLBACK") + raw.execute("DROP TRIGGER refuse_writer") + raw.close() + assert recount(store) == kept + store.land(source_path="b.md", digest="v1", provenance=OBSERVED, title="B", + chunks=_chunks("beta")) + assert store.holds_current("b.md", "v1") and recount(store)[0] == {(AUTHORED, 1, 2), + (OBSERVED, 1, 1)} + + +def test_a_store_opened_while_another_holds_its_lock_opens_at_once_and_counts_its_queries( + tmp_path: Path): + """The migration does not wait for the write lock: a store from before the statistics, + opened while another connection holds the lock (another process counting it, or writing), + opens at once and scores with statistics counted from the units, the same integers the + tables will hold, so the same scores; the first query after the lock is free counts them.""" + import sqlite3 + import time + + from tests.fixtures.lexical_reference import new_search, old_scores, old_search, recount + + path = tmp_path / "lex.sqlite" + _old_store(path, TOKENIZER) + raw = sqlite3.connect(str(path), isolation_level=None) + raw.execute("BEGIN IMMEDIATE") # another connection's write lock + t0 = time.perf_counter() + store = LexicalStore(path) + assert time.perf_counter() - t0 < 5 and not store._counted() + asked = [(q, cls) for q in ("spectral gap", "random graphs", "the gap", "absent") + for cls in (None, [Provenance.OBSERVED], [Provenance.AUTHORED_SOLO])] + for q, cls in asked: + assert new_search(store, q, k=10, classes=cls) == old_search(store, q, k=10, classes=cls) + assert store.scores(q, classes=cls) == old_scores(store, q, classes=cls) + counted = store.statistics(classes=[Provenance.OBSERVED], terms=["gap", "random"]) + assert not store._counted() + raw.execute("ROLLBACK") + raw.close() + assert new_search(store, "the gap", k=3) == old_search(store, "the gap", k=3) + assert store._counted() # that query counted them + assert store.statistics(classes=[Provenance.OBSERVED], terms=["gap", "random"]) == counted + recount(store) + + +@pytest.mark.parametrize("fault", ["read-only", "full"]) +def test_a_store_that_cannot_take_the_count_opens_and_answers_from_its_units( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch, fault: str): + """The count is a write the open and the queries make, and it never fails them. When it + fails for a reason other than another connection's lock (a file this process cannot write; + a full file, which SQLite refuses as a full disk refuses it), it is rolled back, the store + stays as it was and scores as the old statements do, its statistics counted from the units, + and it does not try the count again until it is opened again; a write fails, as any write + to such a file does. Its next open counts them.""" + import os + import sqlite3 + import stat + + from tests.fixtures.lexical_reference import new_search, old_scores, old_search, recount + + path = tmp_path / "lex.sqlite" + _old_store(path, TOKENIZER) + connect = sqlite3.connect + + def full(*args: Any, **kwargs: Any) -> sqlite3.Connection: + conn = connect(*args, **kwargs) + (pages,) = conn.execute("PRAGMA page_count").fetchone() + conn.execute(f"PRAGMA max_page_count = {pages}") # not one page more + return conn + + if fault == "full": + monkeypatch.setattr(sqlite3, "connect", full) + else: + os.chmod(path, stat.S_IRUSR) + try: + store = LexicalStore(path) + assert not store._counted() and not store._conn.in_transaction + ran: list[str] = [] + store._conn.set_trace_callback(ran.append) + for q in ("spectral gap", "random graphs", "the gap", "absent"): + for cls in (None, [Provenance.OBSERVED], [Provenance.AUTHORED_SOLO]): + assert new_search(store, q, k=10, classes=cls) == old_search(store, q, k=10, + classes=cls) + assert store.scores(q, classes=cls) == old_scores(store, q, classes=cls) + assert not any("BEGIN" in s for s in ran) and not store._counted() # not tried again + store._conn.set_trace_callback(None) + with pytest.raises(sqlite3.OperationalError, match="readonly|full"): + store.land(source_path="e.md", digest="v1", provenance=OBSERVED, title="E", + chunks=_chunks(" ".join(f"w{i}" for i in range(2000)))) + assert not store._conn.in_transaction + store.close() + finally: + for name in ("", "-wal", "-shm"): # SQLite made the companions read-only, as the file + if Path(f"{path}{name}").exists(): + os.chmod(f"{path}{name}", stat.S_IRUSR | stat.S_IWUSR) + monkeypatch.undo() + again = LexicalStore(path) + assert again._counted() + recount(again) + + +# docs/runbook.md, "Reverting the kept lexical statistics": the step, and the check that the +# triggers stay dropped (it finds none) +_REVERT_STEP = ("DROP TRIGGER IF EXISTS units_kept_insert; " + "DROP TRIGGER IF EXISTS units_kept_update; " + "DROP TRIGGER IF EXISTS units_kept_delete; " + "DELETE FROM meta WHERE key = 'statistics';") +_REVERT_CHECK = "SELECT name FROM sqlite_master WHERE type = 'trigger' AND name GLOB 'units_kept_*'" + + +def test_the_runbooks_revert_step_lets_the_old_code_write_and_the_change_count_again( + tmp_path: Path): + """docs/runbook.md, reverting the kept statistics: once the triggers and the record are + dropped the code before the change writes the units again, and the change, if it lands + again, counts the statistics anew from them instead of trusting tables nobody kept.""" + import sqlite3 + + from tests.fixtures.lexical_reference import old_land, recount + + path = tmp_path / "lex.sqlite" + store = LexicalStore(path) + store.land(source_path="a.md", digest="v1", provenance=AUTHORED, title="A", + chunks=_chunks("alpha beta", "gamma")) + store.close() + raw = sqlite3.connect(str(path), isolation_level=None) + with pytest.raises(sqlite3.IntegrityError): + old_land(raw, TOKENIZER, "b.md", "v1", OBSERVED, "B", _chunks("beta")) + raw.executescript(_REVERT_STEP) + assert raw.execute(_REVERT_CHECK).fetchall() == [] + old_land(raw, TOKENIZER, "b.md", "v1", OBSERVED, "B", _chunks("beta")) + old_land(raw, TOKENIZER, "a.md", "v2", AUTHORED, "A", _chunks("delta")) + raw.close() + again = LexicalStore(path) # the change, landed again + assert again._counted() + assert recount(again)[0] == {(AUTHORED, 1, 1), (OBSERVED, 1, 1)} + + +def test_a_process_of_the_change_left_running_undoes_the_revert_step(tmp_path: Path): + """docs/runbook.md, reverting the kept statistics: a store of the change still open when the + step runs counts the statistics again at its next query, from the units as they are then, + and installs the triggers with them, after which the code before the change cannot write the + units. So the step waits until no process of the change is left, and its check finds the + triggers back when one was.""" + import sqlite3 + + from tests.fixtures.lexical_reference import old_land, recount + + path = tmp_path / "lex.sqlite" + live = LexicalStore(path) # a process of the change, still running + live.land(source_path="a.md", digest="v1", provenance=AUTHORED, title="A", + chunks=_chunks("alpha beta", "gamma")) + raw = sqlite3.connect(str(path), isolation_level=None) + raw.executescript(_REVERT_STEP) + old_land(raw, TOKENIZER, "b.md", "v1", OBSERVED, "B", _chunks("beta")) # the reverted code + assert raw.execute(_REVERT_CHECK).fetchall() == [] and not live._counted() + assert [h.source_path for h in live.search("alpha", k=3)] == ["a.md"] # its next query + assert len(raw.execute(_REVERT_CHECK).fetchall()) == 3 and live._counted() + assert recount(live)[0] == {(AUTHORED, 2, 3), (OBSERVED, 1, 1)} # b.md counted too + with pytest.raises(sqlite3.IntegrityError, match="keeps statistics"): + old_land(raw, TOKENIZER, "c.md", "v1", OBSERVED, "C", _chunks("gamma")) + raw.close() diff --git a/tests/unit/test_stress_battery.py b/tests/unit/test_stress_battery.py new file mode 100644 index 00000000..c8032588 --- /dev/null +++ b/tests/unit/test_stress_battery.py @@ -0,0 +1,57 @@ +"""The stress battery (eval/stress_battery.py) on a small instance: it works on clones, leaves +its source as it was, and keeps every query's text and every item's content out of its record.""" + +from __future__ import annotations + +import json +from pathlib import Path + +from core.attestation import Attestation, AttestationStore +from core.kernel.ingest.chunk import Chunk +from core.stores.lexical import LexicalStore +from eval import stress_battery + + +def _instance(root: Path) -> Path: + data = root / "data" + lexical = LexicalStore(data / "lexical.sqlite") + for i in range(6): + lexical.land(source_path=f"corpus/s/{i}", digest=f"d{i}", provenance="observed", + title=f"quokka title {i}", chunks=[Chunk(0, f"quokka words of item {i}")]) + lexical.close() + ledger = AttestationStore(data / "attestations.sqlite") + for i in range(8): + ledger.append(Attestation.create(timestamp=f"2026-11-11T00:00:0{i}", agent_role="corpus", + action="capture", constitution_fingerprint="F", + input_hashes=[f"h{i}"], output_hashes=[f"h{i}"])) + ledger.close() + return data + + +def test_the_battery_reads_clones_and_keeps_texts_out_of_its_record(tmp_path: Path) -> None: + data = _instance(tmp_path) + before = {p.name: (p.stat().st_size, p.stat().st_mtime_ns) for p in data.iterdir()} + out = tmp_path / "record.json" + stress_battery.run(stress_battery.parse([ + "--source", str(data), "--scratch", str(tmp_path / "scratch"), "--out", str(out), + "--parts", "keyword,ledger,concurrent,stratum,cut,mask", "--passes", "1", "--fresh", "0", + "--draw", "3", "--paths", "3", "--concurrent-delay", "0"])) + record = json.loads(out.read_text()) + assert set(record["parts"]) == {"keyword", "ledger", "concurrent", "stratum", "cut", "mask"} + assert set(record["prepare"]) == {"lexical.sqlite", "attestations.sqlite"} + assert all(p["migrated"] for p in record["prepare"].values()) + keyword = record["parts"]["keyword"] + assert set(keyword["shapes"]) == {"free-class", "free-all", "paths-scores", "paths-search"} + assert all(r["stable"] for rows in keyword["shapes"].values() for r in rows.values()) + assert record["parts"]["ledger"]["records"] == 8 + concurrent = record["parts"]["concurrent"] + assert "error" not in concurrent["first"] and "error" not in concurrent["second"] + for part in ("stratum", "cut", "mask"): + assert record["parts"][part]["status"].startswith("not run") + assert "quokka" not in out.read_text() # no title, no text, no answer + assert {p.name: (p.stat().st_size, p.stat().st_mtime_ns) for p in data.iterdir()} == before + + +def test_the_battery_caps_blas_at_four_threads_and_keeps_fewer() -> None: + assert [stress_battery._cap_threads(v) for v in (None, "8", "4", "2", "0", "x")] == \ + ["4", "4", "4", "2", "4", "4"]