Repository navigation
perf(cli): a template's component line resolves its names in one pass, not one full lookup per name - #12680
perf(cli): a template's component line resolves its names in one pass, not one full lookup per name#12680josephfarina wants to merge 3 commits into
Conversation
…, not one full lookup per name
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 6aa0d28 |
PR Analysis Report🔎 Preview ·
|
…en from the component list, as before
|
/approve-spec 10c14c4 |
There was a problem hiding this comment.
Changes requested: one release-note sentence needs correcting; the code change itself keeps every template answer the same.
- The changeset says "a name the component list holds needs no lookup", but in a project with an integration a name the list holds under a package with component docs of the older kind (
astryx.docs) is still looked up in full (packages/cli/api/template/_adapter.mjslines 139–151, and the new test for that case), so please reword it to "a name the component list holds under Core or a configured integration needs no lookup", as the description says.
The components named match the base for every template source in a Core-only project and in a project with an integration, and the two new read-count tests fail on the base and pass here. CI has not run on this head yet.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claims
- Every command prints what it printed for every template, with and without an integration: verified (base and head name identical components for 790 template sources; the copy component tests pass).
- A component is named exactly when the importing package documents it, in first-use order, each once, qualified as before: verified (
answeredNameintemplate-adapter.mjs; first new test). - A name the list holds under Core or a configured integration needs no lookup: verified (
_adapter.mjslines 135–138; read-count test). - A package with component docs of the older kind is still looked up: verified (
_adapter.mjslines 139–151; the new test for that case). - A package that cannot own a component needs no lookup: verified (
ownersOfonly returns Core, a configured integration or an installed package with component docs). - Other names, such as a Core component an integration replaces or a part a family doc documents, are looked up in full: verified (the list files a replacement under its integration).
- The full lookups of one template share each folder listing and doc read: verified (one listing-cache operation and per-operation recorded docs; second read-count test).
- Outside an operation discovery behaves as before: verified (both new helpers compute fresh or return nothing outside an operation).
- On the base, the last two new tests fail: verified (2 failed, 2 passed with the new test file on the base).
- The copy component tests pass unchanged: verified (20 passed; file unchanged).
- Timing table and remaining-cost figures: not re-measured; the review's own run is faster in the same direction.
- Byte-for-byte comparison of 3,140 and 3,424 cases: not re-run; corroborated by the 790-source comparison above.
- No CI impact: verified (no workflow, action or CI script changes).
- No public API or behavior change: verified (the changed functions are not exported from the package).
- Changeset, "a name the component list holds needs no lookup": false (finding above).
- Changeset, chart-library imports need no lookup, looked-up names share listings and doc reads, every answer unchanged: verified.
- Changeset, about 0.3–0.7 s faster with an integration: not re-measured; in line with the description's table.
- Files
.changeset/template-components-one-pass.md: finding abovepackages/cli/api/template/_adapter.mjs: clearpackages/cli/api/template/copy/copy.mjs: clearpackages/cli/api/template/show/show.mjs: clearpackages/cli/api/template/template.components-lookup.test.mjs: clearpackages/cli/foundation/discovery/component-discovery.mjs: clearpackages/cli/foundation/discovery/template-adapter.mjs: clear
|
/approve-spec dafca32 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet.
The changeset now says that a name the component list holds under Core or a configured integration needs no lookup, which matches the code, so the earlier request is resolved. The component line still names the same components: the new documents check agrees with a full owner lookup for every name probed in a project with an integration, and the two read-count tests fail on the base and pass here.
Claims and files checked
Review mode: incremental; reason: none
- Changed rules since the last review (0): none
- Claims
- Every command prints what it printed for every template, with and without an integration: verified (
documentsmatches a full owner lookup for every probed name; 790 template sources are named identically on base and head; the copy component tests pass). - A component is named exactly when the importing package documents it, in first-use order, each once, qualified as before: verified (
answeredNameintemplate-adapter.mjs; first new test). - A name the list holds under Core or a configured integration needs no lookup: verified (
_adapter.mjslines 135–138; read-count test). - A package with component docs of the older kind is still looked up: verified (
_adapter.mjslines 139–151; second new test). - A package that cannot own a component needs no lookup: verified (
_adapter.mjslines 139–149; a full lookup only ever names Core, a configured integration or an installed package with component docs). - Every other name is looked up in full, as before: verified (
_adapter.mjsline 151). - The full lookups of one template share each folder listing and one walk of the integration docs: verified (one listing-cache operation in
template-adapter.mjs; per-operation recorded docs; a name found by its own doc reads that doc's metadata once more, as the new test states). - Outside an operation discovery behaves as before, and the probe skip applies only to ASCII names in all-ASCII folders: verified (
component-discovery.mjslines 1838–1845 and 1864). - On the base, the last two new tests fail: verified (2 failed, 2 passed with the new test file on the base).
- The copy component tests pass unchanged: verified (20 passed; file unchanged).
- Timing table and remaining-cost figures: not reproduced as stated; the repository's own CLI is faster on two templates in a smaller project with an integration.
- Byte-for-byte comparison of every template command: not re-run; corroborated by the comparisons above.
- No CI impact: verified (no workflow, action or CI script changes).
- No public API, product behavior or policy change, and no internal context in public text: verified (the changed functions are not exported; output unchanged; no internal references in the added lines, commits or description).
- The listed test suites, type check and command-structure check pass: partly verified (the template, component, discovery and listing-cache suites and the command-structure check pass; the full suite and type check were not re-run).
- Changeset,
[perf]patch for the CLI: verified (the changeset check passes). - Changeset, names held under Core or a configured integration and chart-library imports need no lookup, looked-up names share listings and doc reads, every answer unchanged: verified.
- Changeset, about 0.3–0.7 s faster with an integration: not re-measured; within the description's table.
- Every command prints what it printed for every template, with and without an integration: verified (
- Files
.changeset/template-components-one-pass.md: clear (earlier finding fixed)packages/cli/api/template/_adapter.mjs: clearpackages/cli/api/template/copy/copy.mjs: clearpackages/cli/api/template/show/show.mjs: clearpackages/cli/api/template/template.components-lookup.test.mjs: clearpackages/cli/foundation/discovery/component-discovery.mjs: clearpackages/cli/foundation/discovery/template-adapter.mjs: clear
…s in one pass, not one full lookup per name
- #12680 perf(cli): a template's component line resolves its names in one pass, not one full lookup per name Author: Joey <[email protected]> - #12180 fix(core): Calendar weekday names widen their column instead of overlapping Author: Joey <[email protected]> - #12159 feat(cli): make an icon set inside your own app Author: Joey Farina <[email protected]> - #12383 fix(Grid): a responsive column shrinks to a container narrower than minWidth Author: Joey Farina <[email protected]> - #12374 [fix] Icon: a glyph given as name renders and warns, instead of crashing Author: Joey Farina <[email protected]> - #12453 fix(charts): line, area and band default to straight segments Author: josephfarina <[email protected]> - #12296 fix(core): a neutral Badge in a primary or destructive Button meets 4.5:1 on its fill Author: Joey Farina <[email protected]> - #12395 fix(CodeBlock): without a code string, CodeBlock names the prop and the fix in development Author: Joey Farina <[email protected]> - #12260 fix(cli): `astryx component Flex` names Stack first Author: Joey Farina <[email protected]> - #12391 fix(core): a two-lane Toolbar wraps instead of squeezing its start lane Author: Joey Farina <[email protected]> - #12427 fix(core): checkbox and radio marks keep their share of the box a theme sizes Author: josephfarina <[email protected]> - #12725 [experimental] cli: with no icon set, experimental icon names the discover search where it lists packs Author: Joey Farina <[email protected]>
|
Landed in #12738. |
Maintainer impact
Since "name a template's components for one component read" (#12389), every
astryx templateanswer names the components the template uses, and works them out by looking up every owner of each imported name in full: Core's docs, each integration's component folders and every integration doc, once per name. Nothing is shared between the names or kept. In a project with an integration, a dashboard template's 15 components and its chart-library imports cost about 0.5 s on every call, and a larger template about 0.9 s.Intended invariant
astryx.docs, is an owner only when neither Core nor an integration documents the name, so it is still looked up);SideNavthat an integration replaces, a part only a family doc documents).Change
api/template/_adapter.mjs:loadComponentLookupalso returnsdocuments(package, name), answered as above.foundation/discovery/template-adapter.mjs:answeredComponentsInSourceasksdocumentswhen given (elseownersOf, as the tests' lookups do), and runs its lookups in one listing-cache operation.foundation/discovery/component-discovery.mjs: inside an operation, the docs an integration's components folder records are read once (not once per name), and a same-stem probe skips a folder whose listing has no entry of that name in any case (only for ASCII names in folders whose entry names are all ASCII). Outside an operation nothing changes.api/template/template.components-lookup.test.mjs: the lookup names what a lookup of every owner names, in first-use order; a component of a package with docs of the older kind, under a name Core documents too, is not named, as before; names the list holds and chart-library imports read none of an integration's docs; full lookups do not read more as the names grow. On the base, the last two fail.api/template/copy/copy.components.test.mjspasses unchanged.Evidence
template dashboard --type pagetemplate table-filter --jsontemplate dashboard --type pagetemplate table-filter --jsonWhat the line still costs, measured against the CLI before it existed: parsing the template source (about 60 ms), and in a project with no integration, gathering the component list (about 28 ms; such a project keeps nothing between runs) and finding the installed packages with component docs for a chart library's imports (about 14 ms). Those are the line's own work; this change removes the per-name lookups.
Product/runtime behavior verified unchanged: every template the CLI lists, as
template <name>,template <name> --json, and a copy with and without--json(the printed receipt and the written file), matched byte for byte before and after: 785 templates (3,140 cases) in a Core-only project and 856 templates (3,424 cases) in a project with an integration.CI impact: none (no workflow, action or CI script changes).
Scope
Components: cli (template, component lookups)
Testing
foundation/discovery, the listing cache, build, the template and component commands, the golden outputs and the installed packed kept-catalog file pass (200 files, 2,351 tests), as do the strict type check and the command-structure check.