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

fix(autofix): Cache repo client objects to avoid re-initialization #1626

Merged
merged 5 commits into from
Dec 13, 2024

Conversation

roaga
Copy link
Member

@roaga roaga commented Dec 13, 2024

See this profile.

We were creating new repo clients over and over again, and each time, it added 1-1.5s.

  • before invoking a step, ~1.5s redundant
  • pre-filling coding step memory: ~5s (more for more files)
  • every expand_document tool call: ~1s

This PR stores created repo clients in memory in the context so that throughout a single step, we only need to initialize one repo client for each repo.

@roaga roaga requested a review from a team as a code owner December 13, 2024 18:31
Copy link
Contributor

@trillville trillville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@roaga
Copy link
Member Author

roaga commented Dec 13, 2024

Callout from Ram: is the RepoClient holding open any connections? If so, that would be a problem.

However, I think it's not doing that. It's just wrapping HTTP requests.

But @jennmueng can you confirm?

Copy link
Member

@jennmueng jennmueng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find! functools.cache might be a simpler solution. Also, yeah it should just be http requests from the github client!

@roaga roaga enabled auto-merge (squash) December 13, 2024 22:57
@roaga roaga merged commit 1bfe12f into main Dec 13, 2024
5 checks passed
@roaga roaga deleted the autofix/cache-repo-clients branch December 13, 2024 23:33
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.

3 participants