Lines 755–765 at 274 (were 755–761 at 273)
755755 const relocs = this.#hasMoves ? this.#relocationsN() : undefined; 756756 const files = new Set<number>([-1 - start, ...(this.#movedInFrom().get(path) ?? [])]); 757757 const children = new Map<number, Child[]>(); 758− const texts = new Map<number, string | null>();
758+ // Where each line's text is: its file and its place in that file's packed history. Texts are read after the walk, 759+ // only for the lines it shows (abso Capacity): every text a file and its moved-in sources ever had was read for 760+ // every layout, and abso's worker files, split out of index.ts, read all of index.ts's history each. 761+ const textFile = new Map<number, number>(); 762+ const textPlace = new Map<number, number>(); 759763 const writers = new Map<number, number>(); 760764 const places = new Map<number, number>(); 761765 const deleters = new Map<number, number[]>(); Lines 774–782 at 274 (were 770–778 at 273)
772776 for (const file of files) { 773− const lineTexts = graph.packedTexts(file);
774778 for (const [n, parent, seq, k, replaces] of graph.packedLines(file)) { 775− const text = lineTexts.next().value as string | null;
776780 if (!this.#has(seq)) continue; 777781 const moved = relocs?.get(n); Lines 789–796 at 274 (were 785–791 at 273)
785789 const list = children.get(at); 786790 if (list) list.push(child); 787791 else children.set(at, [child]); 788− texts.set(n, text);
792+ textFile.set(n, file); 793+ textPlace.set(n, place); 789794 writers.set(n, seq); Lines 801–807 at 274 (were 796–802 at 273)
796801 else deleters.set(n, [deleter]); 798803 // Runs written elsewhere under this file's lines follow them; the loop reads their files too. 799− for (const [parent, into] of graph.packedCrossings(file)) if (texts.has(parent)) files.add(into);
804+ for (const [parent, into] of graph.packedCrossings(file)) if (writers.has(parent)) files.add(into); 801806 const order = (a: Child, b: Child) => 802807 b.replaces - a.replaces || b.lamport - a.lamport || b.seq - a.seq || a.k - b.k; Lines 814–831 at 274 (were 809–814 at 273)
809814 const seqWriter: number[] = []; 810815 const seqK: number[] = []; 811816 const deletedBy = new Map<number, readonly number[]>(); 817+ // The text pages read for this layout, by file and page: each at most once. 818+ const pages = new Map<number, Map<number, readonly (string | null)[]>>(); 819+ const textOf = (n: number): string | null => { 820+ const file = textFile.get(n)!; 821+ const place = textPlace.get(n)!; 822+ const page = Math.floor(place / 256); 823+ let byPage = pages.get(file); 824+ if (!byPage) pages.set(file, (byPage = new Map())); 825+ let texts = byPage.get(page); 826+ if (!texts) byPage.set(page, (texts = graph.packedTextPage(file, page))); 827+ return texts[place % 256] ?? null; 812829 const stack: number[] = []; 813830 const push = (code: number) => { 814831 const list = children.get(code); Lines 841–847 at 274 (were 824–830 at 273)
824841 if (complete) deletedBy.set(seq.length, by.length > 1 ? by.sort(priority) : by); 827− visText.push(texts.get(n) ?? null);
844+ visText.push(textOf(n)); 828845 visWriter.push(writers.get(n)!); 829846 visK.push(places.get(n)!);