Lines 15–29 at 119 (were 15–22 at 118)
18−import { type GraphStateStorage, type StateMap, storedArray, storedMap, storedNumbers } from "./state-source.ts";
19+ type GraphStateStorage, 25+} from "./state-source.ts"; Lines 321–327 at 119 (were 314–320 at 118)
314321 this.#dependents = storedMap(storage, "dependents"); 315322 this.#resolvers = storedMap(storage, "resolvers"); 316323 this.#together = storedMap(storage, "together"); 317− this.#fileAtoms = storedMap(storage, "file-atoms");
324+ this.#fileAtomPages = storedLists<AtomId>(storage, "file-atoms"); 318325 this.#runStarts = storedMap(storage, "run-starts"); 319326 this.#relocations = storedMap(storage, "relocations"); 320327 this.#relocatedTo = storedMap(storage, "relocated-to"); Lines 427–433 at 119 (were 420–425 at 118)
420427 #resolvers: StateMap<AtomId, AtomId | AtomId[]> = new Map(); 421428 #together: StateMap<AtomId, TogetherLink[]> = new Map(); 422429 #fileAtoms: StateMap<string, AtomId[]> = new Map(); 430+ #fileAtomPages: ReturnType<typeof storedLists<AtomId>> | undefined; 423431 /** First lines of runs (their n), by the node they were written after: a line's n, or -1 - a path's index. */ 424432 #runStarts: StateMap<number, number | number[]> = new Map(); 425433 /** 1 for the first line of a run whose atom deleted the line it hangs off: the run replaces it. */ Lines 710–729 at 119 (were 702–713 at 118)
703711 /** Every atom that inserts or deletes a line of the file, in seq order. */ 704712 atomsIn(file: string): readonly AtomId[] { 713+ if (this.#fileAtomPages) return [...this.#fileAtomPages.values(file)]; 705714 return this.#fileAtoms.get(file) ?? EMPTY; 716+ *eachAtomIn(file: string): IterableIterator<AtomId> { 717+ if (this.#fileAtomPages) yield* this.#fileAtomPages.values(file); 718+ else yield* this.#fileAtoms.get(file) ?? EMPTY; 720+ hasAtomsIn(file: string): boolean { 721+ return this.#fileAtomPages ? this.#fileAtomPages.length(file) > 0 : this.#fileAtoms.has(file); 708724 /** Unique historical file paths, streamed without collecting their names. */ 709725 *knownFiles(): IterableIterator<string> { 710− yield* this.#fileAtoms.keys();
726+ yield* this.#fileAtomPages ? this.#fileAtomPages.keys() : this.#fileAtoms.keys(); Lines 997–1006 at 119 (were 981–987 at 118)
981997 files.add(isStartNode(m.parent) ? m.parent.slice(1) : this.lineFile(m.parent)!); 983999 this.#atomFiles.push(Object.freeze([...files].sort())); 984− for (const file of files) pushIndex(this.#fileAtoms, file, frozen.id);
1000+ for (const file of files) { 1001+ if (this.#fileAtomPages) this.#fileAtomPages.append(file, frozen.id); 1002+ else pushIndex(this.#fileAtoms, file, frozen.id); 9851004 for (const r of frozen.reasons) { 9861005 if (r.kind !== "together" || r.to === frozen.id) continue; 9871006 pushIndex(this.#together, frozen.id, { other: r.to, text: r.text, from: frozen.id });