{"draft":null,"from":126,"to":127,"files":[{"path":"src/engine/graph.ts","added":26,"removed":10,"diff":"--- a/src/engine/graph.ts\n+++ b/src/engine/graph.ts\n@@ -323,9 +323,11 @@\n \t\t\tthis.#together = storedMap(storage, \"together\");\n \t\t\tthis.#fileAtomPages = storedLists<AtomId>(storage, \"file-atoms\");\n \t\t\tthis.#runStarts = storedMap(storage, \"run-starts\");\n-\t\t\tthis.#relocations = storedMap(storage, \"relocations\");\n-\t\t\tthis.#relocatedTo = storedMap(storage, \"relocated-to\");\n-\t\t\tthis.#relocatedToCode = storedMap(storage, \"relocated-to-code\");\n+\t\t\tthis.#relocationPages = storedLists<RelocationInfo>(storage, \"relocations\");\n+\t\t\tthis.#relocatedToPages = storedLists<RelocationInfo>(storage, \"relocated-to\");\n+\t\t\tthis.#relocatedToCodePages = storedLists<RelocationInfo>(storage, \"relocated-to-code\", (key) =>\n+\t\t\t\tJSON.stringify([\"number\", Number(key)]),\n+\t\t\t);\n \t\t\tthis.#labels = storedMap(storage, \"labels\");\n \t\t}\n \t}\n@@ -438,9 +440,12 @@\n \t/** 1 for the first line of a run whose atom deleted the line it hangs off: the run replaces it. */\n \t#replacing: NumberIndex = new Ints(true);\n \t#relocations: StateMap<LineId, RelocationInfo[]> = new Map();\n+\t#relocationPages: ReturnType<typeof storedLists<RelocationInfo>> | undefined;\n \t#relocatedTo: StateMap<NodeId, RelocationInfo[]> = new Map();\n+\t#relocatedToPages: ReturnType<typeof storedLists<RelocationInfo>> | undefined;\n \t/** The same relocations by node code (a line's n, or -1 - a path's index), for views laid out by number. */\n \t#relocatedToCode: StateMap<number, RelocationInfo[]> = new Map();\n+\t#relocatedToCodePages: ReturnType<typeof storedLists<RelocationInfo>> | undefined;\n \t#movers: AtomId[] = [];\n \t#atomFiles: (readonly string[])[] = [];\n \t/** Each atom's deleted lines by n, packed (#46), or undefined when it deletes none. */\n@@ -631,8 +636,13 @@\n \n \t/** Every relocation that puts a line right after the node with this code. */\n \trelocatedToCode(code: number): readonly RelocationInfo[] {\n+\t\tif (this.#relocatedToCodePages) return [...this.eachRelocatedToCode(code)];\n \t\treturn this.#relocatedToCode.get(code) ?? EMPTY;\n \t}\n+\t*eachRelocatedToCode(code: number): IterableIterator<RelocationInfo> {\n+\t\tif (this.#relocatedToCodePages) yield* this.#relocatedToCodePages.values(String(code));\n+\t\telse yield* this.#relocatedToCode.get(code) ?? EMPTY;\n+\t}\n \n \t/** How many lines every atom together has written. */\n \tget lineCount(): number {\n@@ -782,11 +792,17 @@\n \n \t/** Every relocation of a line, in seq order. */\n \trelocationsOf(line: LineId): readonly RelocationInfo[] {\n+\t\tif (this.#relocationPages) return [...this.eachRelocationOf(line)];\n \t\treturn this.#relocations.get(line) ?? EMPTY;\n \t}\n+\t*eachRelocationOf(line: LineId): IterableIterator<RelocationInfo> {\n+\t\tif (this.#relocationPages) yield* this.#relocationPages.values(line);\n+\t\telse yield* this.#relocations.get(line) ?? EMPTY;\n+\t}\n \n \t/** Every relocation that puts a line right after this node, in seq order. */\n \trelocatedTo(node: NodeId): readonly RelocationInfo[] {\n+\t\tif (this.#relocatedToPages) return [...this.#relocatedToPages.values(node)];\n \t\treturn this.#relocatedTo.get(node) ?? EMPTY;\n \t}\n \n@@ -998,13 +1014,13 @@\n \t\t}\n \t\t(frozen.moves ?? []).forEach((m, i) => {\n \t\t\tconst info: RelocationInfo = Object.freeze({ atom: frozen.id, line: m.line, parent: m.parent, k: i });\n-\t\t\tpushIndex(this.#relocations, m.line, info);\n-\t\t\tpushIndex(this.#relocatedTo, m.parent, info);\n-\t\t\tpushIndex(\n-\t\t\t\tthis.#relocatedToCode,\n-\t\t\t\tisStartNode(m.parent) ? -1 - this.#pathOf(m.parent.slice(1)) : this.#lineN(m.parent),\n-\t\t\t\tinfo,\n-\t\t\t);\n+\t\t\tif (this.#relocationPages) this.#relocationPages.append(m.line, info);\n+\t\t\telse pushIndex(this.#relocations, m.line, info);\n+\t\t\tif (this.#relocatedToPages) this.#relocatedToPages.append(m.parent, info);\n+\t\t\telse pushIndex(this.#relocatedTo, m.parent, info);\n+\t\t\tconst parentCode = isStartNode(m.parent) ? -1 - this.#pathOf(m.parent.slice(1)) : this.#lineN(m.parent);\n+\t\t\tif (this.#relocatedToCodePages) this.#relocatedToCodePages.append(String(parentCode), info);\n+\t\t\telse pushIndex(this.#relocatedToCode, parentCode, info);\n \t\t});\n \t\tif (frozen.moves) this.#movers.push(frozen.id);\n \t\tfor (const n of deletedN) {"}],"unmatched":[]}