Repository navigation
perf(cli): a run takes each kept list of reads once - #11877
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet.
Taking each kept list once per record and deferring the CLI-file merge on a gather hit leave every record and derived-value key the same: the new test row fails without the skip and passes with it, and random sequences of repeated hand-ins give identical records before and after. Nothing needs to change.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim (changeset): a command that reuses kept data hands each kept list to the run's records once, not once per reusing step. Verified:
packages/cli/foundation/fs/read-record.mjs:378-384and the new test row. - Claim (changeset): the CLI-file states a derived value keys on are worked out only when one is asked for. Verified:
packages/cli/foundation/fs/gather-cache.mjs:955and:1029. - Claim (changeset):
component,docs,doctor,search,templateandtheme listfinish 4 to 14 ms sooner in a project with a large integration. Unverified, not false: the author's paired timings; the work it removes is verified in code. - Claim (changeset and description): output, flags and JSON shape do not change. Verified: no command, command doc, formatter or export changes, and the records a run keeps are identical.
- Claim (description): a handed-in list does not change and a record keeps each path's fullest state, so a second hand-in changes nothing. Verified: both callers hand in parsed, snapshot or finished lists (
gather-cache.mjs:942,read-record.mjs:516), andkeepStateonly strengthens a state (read-record.mjs:409-421). - Claim (description): 12 hand-ins over about 14,500 states in a warm
theme list. Unverified, not false: the author's count. - Claim (description): only a derived value after a hit reads the CLI-file states. Verified:
persistedDerivedis the only reader (gather-cache.mjs:1028-1033). - Claim (description): the merge handles an absent path and an already-held state without the rule. Verified:
gather-cache.mjs:706-710, equivalent tokeepState. - Claim (description): the timing table, and every timed run printing the same output and exit code as main. Unverified, not false: the author's measurements; the identical records support the output part.
- Claim (description): the new row fails with the skip removed. Verified: it fails on the base at
read-record.test.mjs:488and passes on the head. - Claim (description): the
foundation/fsand packed kept-catalog suites pass. Verified: those suites and every other packed kept-catalog suite pass at the head (25 files, 395 passed, 4 skipped). - File
.changeset/reused-states-once.md: clear. - File
packages/cli/foundation/fs/gather-cache.mjs: clear. - File
packages/cli/foundation/fs/read-record.mjs: clear. - File
packages/cli/foundation/fs/read-record.test.mjs: clear.
PR Analysis Report🔎 Preview ·
|
Summary
A command that reuses kept data hands what each kept value read to the run's records, so a gather stored later in the run knows what it depends on. Two parts of that did work the run did not need:
foundation/fs/read-record.mjs:recordStatestakes a list of states once per record. A run handed the same kept list in once for every step that reused it: a kept value reused by several loaders, or a base entry under several entries the run read back. A list does not change once handed in, and a record keeps each path's fullest state, so a second hand-in changed nothing. In a warmtheme listin a project with a large integration, 12 hand-ins went over about 14,500 states, most of them already held.foundation/fs/gather-cache.mjs: a hit leaves the states of the CLI's own files it depends on to be worked out when a derived value asks for them. Every hit merged them, and only a derived value after the hit reads them. The merge takes the common cases, a path not held yet and a state already held, without the rule.Evidence
Warm wall time, a fresh process per call, base (main) and change interleaved, n=21, median of the paired difference (95% CI):
component Buttondocs themedoctorsearch buttontemplate dashboardtheme listtheme list --jsonIdentity: every timed run printed the same stdout and stderr, with the same exit code, as main.
Tests
foundation/fs/read-record.test.mjs: a list of states is taken once per record, however often a run hands it in, and in full by another record. The row fails with the skip removed.foundation/fsand both packed kept-catalog suites: 18 files, 338 tests pass.Scope
No output, flag or JSON shape changes.