Skip to content

Improve registry hot paths#1475

Open
ricardo-devis-agullo wants to merge 1 commit into
masterfrom
improve-registry-hot-paths
Open

Improve registry hot paths#1475
ricardo-devis-agullo wants to merge 1 commit into
masterfrom
improve-registry-hot-paths

Conversation

@ricardo-devis-agullo
Copy link
Copy Markdown
Collaborator

Three low-risk refactors on registry request‑hot paths that reduce per‑request allocations and avoid unnecessary I/O:

  1. get-component: Replace split/map/split with single‑pass template header parsing
    The per‑render parseTemplatesHeader now walks the header string once instead of twice.
    Result: ~3.4× faster on a 20‑template header.

  2. get-component: Use Set.has + for‑in loop for custom‑header filtering
    The per‑render filterCustomHeaders builds a skip‑set once and iterates with for‑in instead of Object.entries().filter().fromEntries() with repeated includes().
    Result: ~4.9× faster on an 80‑header map with 20 skip entries.

  3. components-details: Replace deep structuredClone/JSON.parse(JSON.stringify()) with shallow per‑component copies
    getFromDirectories no longer clones the entire details object before scanning for missing components.
    Result: ~4× faster on a 1000‑component / 5-version datastore.

  4. repository: Memoize local component discovery when hotReloading is off
    The local.getComponents() filesystem scan is cached after the first call to avoid repeated readdirSync + lstatSync calls.

All existing 838 tests pass without modification. No breaking changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant