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

pr_ performance #2021

Closed
hadley opened this issue Jul 17, 2024 · 2 comments · Fixed by #2062
Closed

pr_ performance #2021

hadley opened this issue Jul 17, 2024 · 2 comments · Fixed by #2062
Labels
git git, GitHub, and CI in general

Comments

@hadley
Copy link
Member

hadley commented Jul 17, 2024

In my heart of hearts I feel like the performance of the pr_ functions is slower than it should be. I don't really have any evidence to base this feeling on, but now that dev profvis defaults to elapsed timing, we now have a way to profile the code and see which API calls are taking up the time.

@jennybc
Copy link
Member

jennybc commented Jul 17, 2024

My bet is that you are working in a repo that is somehow extreme. Like it has lots of PRs or something.

@jennybc jennybc added the git git, GitHub, and CI in general label Jul 22, 2024
@hadley
Copy link
Member Author

hadley commented Sep 10, 2024

I think I now understand the basic problem. pr_init() calls github_remotes() twice: once in github_remote_config() and (often) again in git_default_branch(). Because github_remotes() has to hit the GitHub API, it takes around 300ms. The caching in dev gh speeds this up, but it would be nice to eliminate the double call, either by calling github_remotes() and then passing to both functions, or by capturing the default branch info in github_remote_config().

I'm slightly in favour of the second approach, where we always call github_remote_config() before git_default_branch() because then it's clear that git_default_branch() is not responsibility for warning about bad configs.


We might still a guaranteed fast (but not correct) version of git_default_branch() that uses default_branch_candidates() for functions like pr_forget(), pr_finish(), and pr_resume() that don't call github_remote_config().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
git git, GitHub, and CI in general
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants