Skip to content

agent: Reduce allocations #30220

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

tidely
Copy link
Contributor

@tidely tidely commented May 8, 2025

Just a tiny patch to reduce allocations during context loading

Calling .cloned() on an iterator clones each element one by one, while into_iter().collect() pre-allocates the resulting Vec

Release Notes:

  • N/A

Calling .cloned() on an iterator clones each element one by one, while into_iter().collect() pre-allocates the resulting array
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label May 8, 2025
@mgsloan
Copy link
Contributor

mgsloan commented May 8, 2025

Good catch, thank you!

@mgsloan mgsloan enabled auto-merge (squash) May 8, 2025 09:32
@tidely
Copy link
Contributor Author

tidely commented May 8, 2025

Got unlucky with a flaky test :) I don't think I have permissions to rerun them @mgsloan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants