{"version":238,"agent":"capacity","message":"Collisions: deleted lines found by number, and the move index skips graphs that gained nothing (disk-first 2; abso Capacity).\n\nCollisions on website took 20.7 s cold with one opened writer (replay 0.4 s), and 46 s on typescript-rs (replay 5 s).\n\n- touchedFiles finds each deleted line's file by its number where the view can (fileOfNumber). A draft deleting a big file has thousands; making each one's id only to look its number up again was most of the time.\n- Graph.accepted counts the atoms a graph object has taken in, in memory. The move index (MoveSkeleton) is brought up to date on every lookup of a line's file. It now reads the movers list only when that count has changed: checking the stored list's length and last mover each time cost 3.3 s of collisions on website. A rolled-back add still counts, which only makes it look again.\n\nOn website adopted fresh, cold: collisions 20.7 s to 9.6 s. On typescript-rs: 46 s to 11.7 s. Both match replay, and all 27 typescript-rs answers match. Still slow: reading every draft atom's write keys, a row per key once there are more than 256 (75,000 rows on website).\n\nNamed tests: every engine test (288 of 288), every worker/project test (341 of 341); tsc and biome clean.","time":1792065681704,"timeIso":"2026-10-15T12:01:21.704Z","changes":3,"change":3704,"files":["src/engine/graph.ts","src/engine/view.ts","worker/project/collisions.ts"],"draft":null,"diff":[{"path":"src/engine/graph.ts","added":11,"removed":0,"diff":"--- a/src/engine/graph.ts\n+++ b/src/engine/graph.ts\n@@ -820,6 +820,16 @@\n \t\treturn this.#atoms.length;\n \t}\n \n+\t/**\n+\t * How many atoms this graph object has accepted since it was made (abso Capacity): in memory, so a cache over the\n+\t * graph can tell nothing was added without reading storage. A rolled-back add still counts, which only makes such a\n+\t * cache look again.\n+\t */\n+\tget accepted(): number {\n+\t\treturn this.#accepted;\n+\t}\n+\t#accepted = 0;\n+\n \t/** The id the next accepted atom must have. */\n \tnextId(): AtomId {\n \t\treturn atomId(this.#atoms.length);\n@@ -1530,6 +1540,7 @@\n \t\t\t\t\tthis.#lists ? this.#listReader(seq) : undefined,\n \t\t\t\t);\n \t\tthis.#atoms.push(this.#storage ? atom : frozen);\n+\t\tthis.#accepted++;\n \t\tlet lam = 0;\n \t\tfor (const d of deps) lam = Math.max(lam, this.lamport(d) + 1);\n \t\tif (this.#lamportPages) this.#lamportPages.push(lam);"},{"path":"src/engine/view.ts","added":5,"removed":0,"diff":"--- a/src/engine/view.ts\n+++ b/src/engine/view.ts\n@@ -138,9 +138,14 @@\n \t\tthis.#graph = graph;\n \t}\n \n+\t/** The graph's accepted count when movers were last taken in: nothing to read while it's the same. */\n+\t#stamp = -1;\n+\n \t/** Take in movers the graph gained since. */\n \tupdate(): this {\n \t\tconst graph = this.#graph;\n+\t\tif (this.#stamp === graph.accepted) return this;\n+\t\tthis.#stamp = graph.accepted;\n \t\tconst all = graph.movers();\n \t\tif (this.#seen === all.length) return this;\n \t\tfor (; this.#seen < all.length; this.#seen++) {"},{"path":"worker/project/collisions.ts","added":9,"removed":2,"diff":"--- a/worker/project/collisions.ts\n+++ b/worker/project/collisions.ts\n@@ -282,13 +282,20 @@\n \t\tfor (const file of g.filesOf(id)) out.add(file);\n \t\tif (moved.length === 0) continue;\n \t\tconst atom = g.atom(id);\n-\t\tconst lines: string[] = [...g.deletedLines(id)];\n+\t\tconst lines: string[] = [];\n \t\tfor (const run of atom.inserts) if (!run.parent.startsWith(\"^\")) lines.push(run.parent);\n \t\tfor (const m of atom.moves ?? []) {\n \t\t\tlines.push(m.line);\n \t\t\tif (!m.parent.startsWith(\"^\")) lines.push(m.parent);\n \t\t}\n-\t\tfor (const v of moved) for (const line of lines) out.add(v.fileOf(line));\n+\t\tfor (const v of moved) {\n+\t\t\tfor (const line of lines) out.add(v.fileOf(line));\n+\t\t\t// Deleted lines by number where the view can (abso Capacity): a draft deleting a big file has thousands, and\n+\t\t\t// making each one's id only to look its number up again was most of collisions on website.\n+\t\t\tconst byNumber = (v as { fileOfNumber?: (n: number) => string }).fileOfNumber;\n+\t\t\tif (byNumber) for (const n of g.deletedNumbers(id)) out.add(byNumber.call(v, n));\n+\t\t\telse for (const line of g.deletedLines(id)) out.add(v.fileOf(line));\n+\t\t}\n \t}\n \treturn out;\n }"}],"ci":null}