Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 1b519f390172d964cefff5cc9d4574f83cd60504
parent b64af6e282408a71af4082f9c0605e58a6d20b8b
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue,  8 Sep 2026 01:12:13 -0400

common: the bucket projection hands out the stored array, as it always did

bucketIdsFrom returned readonly string[], so buildChannelWork copied every
bucket on the way in — 68 channels x four buckets per scheduling tick and per
three-second status poll, up to 11,000 strings each. That is the allocation the
snapshot parse memo exists to avoid, and nothing mutates the list. It returns
string[] and the projection stores it directly, which is what the code did
before this slice.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Diffstat:
Mcommon/controller/autoRunner.ts | 5+++--
Mcommon/jobs/autoQueuePolicy.ts | 9+++++----
2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/common/controller/autoRunner.ts b/common/controller/autoRunner.ts @@ -333,7 +333,7 @@ async function buildChannelWork( // leaf (and no policy switch) asks for them, because buildPendingByLeaf // only walks the buckets its `defaultBuckets` / `match.bucket` name. for (const name of selectableBucketsForKind(kind)) { - const ids = [...bucketIdsFrom(snap, name)]; + const ids = bucketIdsFrom(snap, name); buckets[name] = ids; for (const id of ids) if (!owner.has(id)) owner.set(id, slug); } @@ -355,7 +355,8 @@ async function buildChannelWork( // no second operation to keep apart from. const laneWorkList = bucketLaneOperationId(kind); if (laneWorkList) { - const ids = snap.backfill?.[laneWorkList]?.ids ?? bucketLaneWorkIds(kind, snap); + const ids = + snap.backfill?.[laneWorkList]?.ids ?? bucketLaneWorkIds(kind, snap); buckets[laneWorkList] = ids; for (const id of ids) if (!owner.has(id)) owner.set(id, slug); } diff --git a/common/jobs/autoQueuePolicy.ts b/common/jobs/autoQueuePolicy.ts @@ -145,10 +145,11 @@ export type BucketSource = { undownloadedIds?: string[] | null; }; -export function bucketIdsFrom( - source: BucketSource, - name: string, -): readonly string[] { +// Returns the STORED array, not a copy. Every caller reads it, and this runs +// 68 times per bucket per scheduling tick and per three-second status poll — +// copying up to 11,000 strings there is the cost readChannelSnapshotShared's +// memo exists to avoid. +export function bucketIdsFrom(source: BucketSource, name: string): string[] { if (name === "undownloadedIds") return source.undownloadedIds ?? []; return source.buckets?.[name] ?? []; }