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

Optimize AggregatedBytes::to_vec #2786

Merged
merged 3 commits into from
Jun 20, 2023
Merged

Optimize AggregatedBytes::to_vec #2786

merged 3 commits into from
Jun 20, 2023

Conversation

yotamofek
Copy link
Contributor

@yotamofek yotamofek commented Jun 19, 2023

Motivation and Context

Avoid intermediate vec allocations in AggregatedBytes::to_vec.

Description

Calling slice::to_vec on every segment is wasteful, the segments can be just flattened into an iterator over u8s and collected directly. Also makes the code a bit simpler.

Testing

Checklist

  • I have updated CHANGELOG.next.toml if I made changes to the smithy-rs codegen or runtime crates
  • I have updated CHANGELOG.next.toml if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@yotamofek yotamofek requested review from a team as code owners June 19, 2023 05:57
@hlbarber
Copy link
Contributor

This looks good to me, thanks. After briefly describing the change in CHANGELOG.next.toml we can get this merged.

@yotamofek
Copy link
Contributor Author

yotamofek commented Jun 19, 2023

@hlbarber

Added changelog entry, hope it's ok. Seems CI has failed sporadically?

@hlbarber
Copy link
Contributor

Seems CI has failed sporadically?

A dependency introduced a clippy failure into a macro. All fixed now 👍

@hlbarber hlbarber added this pull request to the merge queue Jun 20, 2023
Merged via the queue into smithy-lang:main with commit 2987cbd Jun 20, 2023
@yotamofek yotamofek deleted the aggregated-bytes-to-vec branch June 20, 2023 09:59
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.

4 participants