perf(util-endpoints): reduce temporary object allocations#1957
Open
perf(util-endpoints): reduce temporary object allocations#1957
Conversation
kuhe
approved these changes
Apr 14, 2026
…ent in evaluateEndpointRule
b96ce29 to
6a00f07
Compare
kuhe
reviewed
Apr 15, 2026
| ...options.referenceRecord, | ||
| ...conditionsReferenceRecord, | ||
| }, | ||
| }); |
Contributor
There was a problem hiding this comment.
how can we confirm no edge case relied on this? the diff seems to result in a potentially different set of objects
if it can be proven this is all part of the same evaluation's lifecycle, maybe even the initial copy isn't necessary.
Contributor
There was a problem hiding this comment.
one thing we could do is run the full AWS endpoint test suite
Contributor
Author
There was a problem hiding this comment.
We're not changing the behavior. The conditionOptions object was additive even before. We're just not creating new object for every call.
The test needs to check the first call received an empty referenceRecord at call time, but the spy only holds a reference that's since been mutated. That's why tests had to be updated.
ccc8015 to
78eb850
Compare
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.
Issue
Internal JS-6645
Description
Remove rest spread destructuring that created a new object on every call, and replace conditional spread in the return with an early return branch to avoid temporary object allocation.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.