{"draft":null,"from":115,"to":116,"files":[{"path":"src/engine/view.ts","added":12,"removed":1,"diff":"--- a/src/engine/view.ts\n+++ b/src/engine/view.ts\n@@ -95,6 +95,9 @@\n \t/** The set, made from #in the first time it's asked for: a view keeps a byte per atom, not a copy of the set (#46). */\n \t#set: AtomSet | undefined;\n \treadonly #stable: StableSet<AtomId> | undefined;\n+\t/** Fixed-size memo for immutable indexed membership, independent of history size. */\n+\t#membershipSeq = new Float64Array(256).fill(-1);\n+\t#membershipValue = new Uint8Array(256);\n \t#files = new Map<string, FileState>();\n \t/** Every file the set wrote in, sorted; worked out the first time it's asked for. */\n \t#knownList: string[] | undefined;\n@@ -165,7 +168,14 @@\n \n \t/** Whether the atom with this seq is in the set. */\n \t#has(seq: number): boolean {\n-\t\tif (this.#stable) return this.#stable.has(this.graph.idOfSeq(seq));\n+\t\tif (this.#stable) {\n+\t\t\tconst slot = seq % this.#membershipSeq.length;\n+\t\t\tif (this.#membershipSeq[slot] === seq) return this.#membershipValue[slot] === 1;\n+\t\t\tconst present = this.#stable.has(this.graph.idOfSeq(seq));\n+\t\t\tthis.#membershipSeq[slot] = seq;\n+\t\t\tthis.#membershipValue[slot] = present ? 1 : 0;\n+\t\t\treturn present;\n+\t\t}\n \t\treturn seq < this.#in.length && this.#in[seq] === 1;\n \t}\n \n@@ -498,6 +508,7 @@\n \t */\n \tweight(): number {\n \t\tlet n = this.#in.byteLength;\n+\t\tn += 2 * ARRAY_HEADER_BYTES + this.#membershipSeq.byteLength + this.#membershipValue.byteLength;\n \t\tn += ARRAY_HEADER_BYTES + REFERENCE_BYTES * this.#movers.length;\n \t\tn += MAP_HEADER_BYTES; // #files exists from construction.\n \t\tn += MAP_HEADER_BYTES; // #fileOf exists from construction."}],"unmatched":[]}