Repository navigation
perf: deploy and retrieve flow efficiency improvements @W-24222996@ - #1836
Merged
Merged
Conversation
Use ComponentSet.size getter instead of getSourceComponents().toArray().length. Avoids iterating all source components and allocating a full array just to get a count used for polling frequency calculation.
Spread the lazy collection directly instead of calling .toArray() which allocates an intermediate array. The flatMap only needs iteration, not random access.
Move RegExp allocations out of hot-path functions (parseMetadataXml, getSuggestionsForUnresolvedTypes, parseAsFolderMetadataXml, and baseSourceAdapter resolution) into module-level constants. These functions are called thousands of times during resolution — once per file per resolution attempt.
Replace JSON.stringify-based deduplication in getFileResponses with a composite string key built from the response fields. Avoids serializing every FileResponse object to JSON just to use as a Map key.
Replace O(n*m) linear scan with a Set of type#fullName keys for O(1) lookups. Also extract manifest file names into a module-level Set. For large deploys with hundreds of messages and file responses, this eliminates hundreds of thousands of comparisons.
…ctory Replace the upfront statSync().isDirectory() guard with a try/catch on readdirSync. This eliminates one syscall per readDirectory call — and since callers typically check isDirectory first, it was a double stat on every directory in the resolution tree.
The method resolves API version through a multi-step fallback chain (project config, ConfigAggregator, REST call). Cache the result to avoid redundant lookups on repeated calls.
readDirectory previously scanned all zip entries on every call. Build a Map<dir, children[]> in the constructor for O(1) lookups.
|
This PR lacks any commits of the 'fix' or 'feat' type, and therefore will not trigger a release. To silence all further warnings, react to this warning comment (or any other) with the 👀 emoji. NOTE: If your repo uses squash commits, make sure to add the appropriate conventional commit prefix (e.g., 'fix:', 'feat:', 'chore:', etc) in the squash commit message. |
cs.size counts all map entries including non-SourceComponent metadata, while getSourceComponents() filters to only resolved source-backed components. The count must reflect actual source components for accurate polling frequency calculation.
sourceApiVersion and apiVersion are public mutable properties with no setter hooks, so a cached result can go stale if they are changed after the first call. The method is only called a handful of times per operation, so the fallback chain cost is negligible.
soridalac
approved these changes
Sep 29, 2026
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.
@W-24222996@
Summary
Collection of targeted performance improvements across SDR's deploy and retrieve flows:
getSourceComponents().toArray()with spread syntax inbuildFileResponsesFromComponentSetpath.ts,metadataResolver.ts, andbaseSourceAdapter.tsJSON.stringify()with a string key concatenation ingetFileResponsesArray.find()withSet.has()inwarnIfUnmatchedServerResultstatSync+readdirSyncwith try/catch aroundreaddirSyncinNodeFSTreeContainer.readDirectoryMap<dir, children[]>at construction time instead of O(n) scanning all zip entries on everyreadDirectorycallBenchmark results
Test plan