Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(lib-dynamodb): reduce object copying in iterators #4194

Merged
merged 1 commit into from
Nov 16, 2022

Conversation

kuhe
Copy link
Contributor

@kuhe kuhe commented Nov 15, 2022

Issue

#4151
paired with smithy-lang/smithy-typescript#638

  • reduce object copying in iterators

This reducer style makes pointless object copies via { ...acc}:

.reduce((acc, [key, val]) => ({ ...acc, [key]: val }), {});

We know that removing these copies will have no side-effects because the initial accumulator value is {}, and not an external object that should not be mutated.

New pattern:

.reduce((acc, [key, val]) => (acc[key] = val, acc), {});

@kuhe
Copy link
Contributor Author

kuhe commented Nov 16, 2022

split codegen changes into #4198

@trivikr trivikr changed the title chore(reducers): reduce object copying in iterators chore(lib-dynamodb): reduce object copying in iterators Nov 16, 2022
@kuhe kuhe merged commit 12faca2 into aws:main Nov 16, 2022
@kuhe kuhe deleted the chore/reducers branch November 16, 2022 17:33
@github-actions
Copy link

github-actions bot commented Dec 1, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants