Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 240 to 241

Compare

+26 −12 in 3 places
Lines 55–82 at 241 (were 55–60 at 240)
5555};
5656
5757const NO_ATTRS: FileAttrs = { exists: false, exec: false, link: null, blob: null };
59+/**
60+ * A file layout's bytes, less its lookup indexes, worked out once per layout (abso Capacity): a layout never changes
61+ * once made, and the view cache weighs every view it holds on every lookup, which summed every line's text again.
62+ */
63+const layoutSizes = new WeakMap<FileState, number>();
64+function layoutBytes(f: FileState): number {
65+ let n = layoutSizes.get(f);
66+ if (n !== undefined) return n;
67+ // FileState and FileAttrs are per laid-out file; typed-array headers are separate from their payload byte lengths.
68+ n = OBJECT_BYTES + OBJECT_BYTES + 2 * ARRAY_HEADER_BYTES;
69+ n += f.seq.byteLength + f.vis.byteLength;
70+ if (f.visText) for (const text of f.visText) n += REFERENCE_BYTES + 2 * (text?.length ?? 0);
71+ if (f.visWriter) n += 4 * f.visWriter.length;
72+ if (f.visK) n += 4 * f.visK.length;
73+ if (f.seqWriter) n += 4 * f.seqWriter.length;
74+ if (f.seqK) n += 4 * f.seqK.length;
75+ n += MAP_HEADER_BYTES + (MAP_ENTRY_BYTES + ARRAY_HEADER_BYTES) * f.deletedBy.size;
76+ for (const deleters of f.deletedBy.values()) n += REFERENCE_BYTES * deleters.length;
77+ layoutSizes.set(f, n);
78+ return n;
79+}
5880const NONE: readonly never[] = Object.freeze([]);
5981
6082interface FileState {
Lines 1109–1115 at 241 (were 1087–1093 at 240)
10871109 * populate lazy caches, enumerate the graph, or count temporary traversal
10881110 * containers and shared empty singleton payloads as retained view state.
10891111 */
1090− weight(): number {
1112+ weight(seen?: Set<object>): number {
10911113 let n = this.#in.byteLength;
10921114 n += 2 * ARRAY_HEADER_BYTES + this.#membershipSeq.byteLength + this.#membershipValue.byteLength;
10931115 if (this.#movers) n += ARRAY_HEADER_BYTES + REFERENCE_BYTES * this.#movers.length;
Lines 1123–1131 at 241 (were 1101–1117 at 240)
11011123 for (const f of this.#files.values()) {
11021124 n += MAP_ENTRY_BYTES;
11031125 if (f !== NO_FILE) {
1104− // FileState and FileAttrs are per laid-out file; typed-array
1105− // headers are separate from their payload byte lengths below.
1106− n += OBJECT_BYTES + OBJECT_BYTES + 2 * ARRAY_HEADER_BYTES;
1107− n += f.seq.byteLength + f.vis.byteLength;
1108− if (f.visText) for (const text of f.visText) n += REFERENCE_BYTES + 2 * (text?.length ?? 0);
1109− if (f.visWriter) n += 4 * f.visWriter.length;
1110− if (f.visK) n += 4 * f.visK.length;
1111− if (f.seqWriter) n += 4 * f.seqWriter.length;
1112− if (f.seqK) n += 4 * f.seqK.length;
1113− n += MAP_HEADER_BYTES + (MAP_ENTRY_BYTES + ARRAY_HEADER_BYTES) * f.deletedBy.size;
1114− for (const deleters of f.deletedBy.values()) n += REFERENCE_BYTES * deleters.length;
1126+ // A layout another view counted already (`seen`, across a cache's views) isn't counted again.
1127+ if (!seen?.has(f)) n += layoutBytes(f);
1128+ seen?.add(f);
11151129 if (f.seqIndex) n += MAP_HEADER_BYTES + MAP_ENTRY_BYTES * f.seqIndex.size;
11161130 if (f.visIndex) n += MAP_HEADER_BYTES + MAP_ENTRY_BYTES * f.visIndex.size;
11171131 }
MCP
compare on this site's /mcp
CLI
abso diff 240 241 src/engine/view.ts --json
JSON
/christopher/abso-core/compare/240..241?file=src%2Fengine%2Fview.ts&format=json