Public: anyone can read this; the crew can change it.

Home's fork line reads parents and forks once, and a fork's offers upstream by the fork: home renders in 72-97 ms, not 156 #17674

opened this

Merged 12h 15m ago, live in production

Profiled on the stage rig's copy (2026-11-13 database and repositories, a throwaway --network none container on the host, signed in as the owner, warm, JSC-sampled over 20 requests; the copy deleted after): "/" took a median 156-171 ms, 630-689 statements and 124-152 ms of it inside SQLite; the HTML was under 1% a part…

Notes

opened this

Profiled on the stage rig's copy (2026-11-13 database and repositories, a throwaway --network none container on the host, signed in as the owner, warm, JSC-sampled over 20 requests; the copy deleted after): "/" took a median 156-171 ms, 630-689 statements and 124-152 ms of it inside SQLite; the HTML was under 1% a part. About 90% was one section, the fork flows line (studio/fork_line.ts -> core/fork_flows.ts), which walks every repository its owner administers: sentOffers 51% pulls into the parent whose head is this fork, joined from issue: with no index on pull.head_repo_id it walked the parent's issues (17,000 on trevato/forge) once a fork forkParentFor 17% two getRepoById a fork listForks (forkOffers) 13% one read a repository, almost all with no forks lastTookAt, the offers query, tip files: the rest

Now: an index on pull(head_repo_id, issue_id), and sentOffers reads from the fork's pulls first (CROSS JOIN fixes the order, so the planner cannot start from the parent's issues); forkFlows reads every parent in one getReposByIds and every fork of every repository in one listForksOf, checks what the viewer may read as forkParentFor and visibleForks did, and hands them to sentOffers and forkOffers (new optional arguments; every other caller reads as before). A repository with no parent and no forks costs the line nothing past its admin check.

The same copy, the same image (0.7.715), the files mounted over it: "/" 156 ms, 689 statements -> 72-97 ms, 325 statements "/?view=table" 115 ms, 676 statements -> 73 ms, 371 statements the index alone (old code on the indexed copy): "/" 125 ms, the table 104 ms What is left of home's SQL: sentOffers once per fork with a parent (32-37%), the stalled-runs read under the header (9-21%), forkOffers and lastTookAt.

test/fork-flows.test.ts: six plain repositories cost the line at most one read more each than one does (the old code: two each, 10 for five; it fails there). On runner-6, main plus this: 131 pass across the fork, schema, counts, page-budget and unused-exports files; tsc and the gate clean. The migration is pinned.

Direction: home's render is the page the owner opens most, and this line was 90% of it (#17629)

Co-Authored-By: Claude Fable 5 <[email protected]>

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs