Improve registry hot paths#1475
Open
ricardo-devis-agullo wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three low-risk refactors on registry request‑hot paths that reduce per‑request allocations and avoid unnecessary I/O:
get-component: Replacesplit/map/splitwith single‑pass template header parsingThe per‑render
parseTemplatesHeadernow walks the header string once instead of twice.Result: ~3.4× faster on a 20‑template header.
get-component: UseSet.has+for‑inloop for custom‑header filteringThe per‑render
filterCustomHeadersbuilds a skip‑set once and iterates withfor‑ininstead ofObject.entries().filter().fromEntries()with repeatedincludes().Result: ~4.9× faster on an 80‑header map with 20 skip entries.
components-details: Replace deepstructuredClone/JSON.parse(JSON.stringify())with shallow per‑component copiesgetFromDirectoriesno longer clones the entire details object before scanning for missing components.Result: ~4× faster on a 1000‑component / 5-version datastore.
repository: Memoize local component discovery whenhotReloadingis offThe
local.getComponents()filesystem scan is cached after the first call to avoid repeatedreaddirSync+lstatSynccalls.All existing 838 tests pass without modification. No breaking changes.