A draft-state or land on a stored graph no longer reads a row per line to describe its collisions, or a row per claimant to pair them (abso 738). Version 317 of shared· capacity· Oct 17 (2026-10-17 08:46 UTC) · Not checked
View's line readers (lines, sequence and the uncached visible lines) name each line's writer with atomId, not graph.idOfSeq. The seq comes from the graph's own layout. idOfSeq's bounds check read the stored atom count once per line, and describing reads both sides' files in full. That was about 0.9 s of a warm draft-state on abso. The claimant walk (orderedClaimants) and hasCommonResolver take each atom's seq from its id, as graph.atom itself does, instead of loading the stored atom to read it. On abso's Oct 14 tables, both named drafts' states are identical by hash (codex-prose-authorship-610: 71db868585a419a4). codex-prose-authorship-610:
warm: 8,863 statements and 2.3 s become 7,820 and 0.92 s. Describing goes from 0.6 s to under 0.1 s, and pairing from 0.4 s to 0.1 s. read cold after the other draft: 12,688 statements and 4.1 s become 11,645 and 2.25 s. What's left of the warm read is mostly the draft's own lines' uses (0.3 s, in proportion to the draft), the clash check and membership values.
Checks: 1,450 tests pass, 0 fail, 2 skipped. tsc is clean and biome is clean.
Version 316 · Files at version 317
2 files, 18 lines added, 14 removed.
--- a/src/engine/view.ts
+++ b/src/engine/view.ts
@@ -10,7 +10,7 @@
10 10 // made when a caller asks for them, and the latest asked for is kept. 12 12 import type { Graph, RelocationInfo } from "./graph.ts"; 13 − import { isStartNode, lineId, seqOf } from "./keys.ts";
13 + import { atomId, isStartNode, lineId, seqOf } from "./keys.ts"; 14 14 import { resolveScratchMoves, scratchLayoutNodes } from "./relocation-scratch.ts"; 15 15 import { isClosedSet, StableSet } from "./state-source.ts"; 16 16 import { joinLines } from "./text.ts"; @@ -1112,7 +1112,7 @@
1113 1113 id: graph.lineIdOf(n), 1114 1114 text: graph.textOf(n), 1115 − atom: graph.idOfSeq(graph.writerSeqOf(n)),
1115 + atom: atomId(graph.writerSeqOf(n)), @@ -1126,12 +1126,12 @@
1126 1126 const n = vis[i]!; 1127 1127 const packed = visText?.[i]; 1129 − id: visWriter && visK ? lineId(graph.idOfSeq(visWriter[i]!), visK[i]!) : graph.lineIdOf(n),
1129 + id: visWriter && visK ? lineId(atomId(visWriter[i]!), visK[i]!) : graph.lineIdOf(n), 1130 1130 textChunks: () => graph.textChunks(n), 1132 1132 return packed ?? graph.textOf(n); 1134 − atom: graph.idOfSeq(visWriter ? visWriter[i]! : graph.writerSeqOf(n)),
1134 + atom: atomId(visWriter ? visWriter[i]! : graph.writerSeqOf(n)), @@ -1143,12 +1143,14 @@
1143 1143 const graph = this.graph; 1144 1144 const { vis, visText, visWriter, visK } = this.#file(path); 1145 1145 const lines: VisibleLine[] = new Array(vis.length); 1146 + // Writer seqs come from the graph's own layout, so they're named with atomId, not checked by idOfSeq (abso 738): 1147 + // on a stored graph its check read the atom count once a line, about 0.9 s of a warm draft-state on abso. 1146 1148 for (let i = 0; i < vis.length; i++) { 1147 1149 const n = vis[i]!; 1149 − id: visWriter && visK ? lineId(graph.idOfSeq(visWriter[i]!), visK[i]!) : graph.lineIdOf(n),
1151 + id: visWriter && visK ? lineId(atomId(visWriter[i]!), visK[i]!) : graph.lineIdOf(n), 1150 1152 text: visText?.[i] ?? graph.textOf(n), 1151 − atom: graph.idOfSeq(visWriter ? visWriter[i]! : graph.writerSeqOf(n)),
1153 + atom: atomId(visWriter ? visWriter[i]! : graph.writerSeqOf(n)), 1154 1156 this.#linesCache = { path, lines }; @@ -1170,13 +1172,13 @@
1170 1172 const writer = seqWriter ? seqWriter[i]! : graph.writerSeqOf(n); 1171 1173 let text: string | undefined; 1173 − id: seqWriter && seqK ? lineId(graph.idOfSeq(writer), seqK[i]!) : graph.lineIdOf(n),
1175 + id: seqWriter && seqK ? lineId(atomId(writer), seqK[i]!) : graph.lineIdOf(n), 1175 1177 text ??= graph.textOf(n); 1178 − atom: graph.idOfSeq(writer),
1179 − deletedBy: by ? by.map((s) => graph.idOfSeq(s)) : NONE,
1180 + atom: atomId(writer), 1181 + deletedBy: by ? by.map((s) => atomId(s)) : NONE, 1180 1182 visible: by === undefined, --- a/worker/project/collisions.ts
+++ b/worker/project/collisions.ts
@@ -68,7 +68,7 @@
69 69 for (const key of claimsOf(atom)) streams.push(g.eachWriterOf(key)); 70 70 const theirs: AtomId[] = []; 71 − for (const id of orderedClaimants(g, streams)) if (against.has(id)) theirs.push(id);
71 + for (const id of orderedClaimants(streams)) if (against.has(id)) theirs.push(id); 72 72 out.set(yours, theirs); @@ -136,7 +136,7 @@
137 137 /** Claim indexes append in canonical seq order. Merge one cursor per current 138 138 * atom key, retaining no candidate set proportional to historical claims. */ 139 − function* orderedClaimants(g: Graph, streams: IterableIterator<AtomId>[]): IterableIterator<AtomId> {
139 + function* orderedClaimants(streams: IterableIterator<AtomId>[]): IterableIterator<AtomId> { 141 141 type Head = { id: AtomId; seq: number; stream: number }; 142 142 const heap: Head[] = []; @@ -152,9 +152,11 @@
155 + // Each claimant's seq from its id, as the graph reads it (abso 738): loading the stored atom for it read a row a 156 + // claimant, most of a warm draft-state's pairing on abso. 155 157 const advance = (stream: number) => { 156 158 const next = streams[stream]!.next(); 157 − if (!next.done) push({ id: next.value, seq: g.atom(next.value).seq, stream });
159 + if (!next.done) push({ id: next.value, seq: seqOf(next.value), stream }); 159 161 for (let stream = 0; stream < streams.length; stream++) advance(stream); 160 162 let previous = -1; @@ -190,8 +192,8 @@
190 192 let a = left.next(); 191 193 let b = right.next(); 192 194 while (!a.done && !b.done) { 193 − const x = g.atom(a.value).seq;
194 − const y = g.atom(b.value).seq;
195 + const x = seqOf(a.value); 196 + const y = seqOf(b.value); 195 197 if (x === y && settled.has(a.value)) return true; 196 198 if (x <= y) a = left.next(); 197 199 if (y <= x) b = right.next();