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

Refactor the usage of batch catfile (#31754) #31889

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

GiteaBot
Copy link
Contributor

Backport #31754 by @lunny

When opening a repository, it will call ensureValidRepository and also CatFileBatch. But sometimes these will not be used until repository closed. So it's a waste of CPU to invoke 3 times git command for every open repository.

This PR removed all of these from OpenRepository but only kept checking whether the folder exists. When a batch is necessary, the necessary functions will be invoked.

When opening a repository, it will call `ensureValidRepository` and also
`CatFileBatch`. But sometimes these will not be used until repository
closed. So it's a waste of CPU to invoke 3 times git command for every
open repository.

This PR removed all of these from `OpenRepository` but only kept
checking whether the folder exists. When a batch is necessary, the
necessary functions will be invoked.
@GiteaBot GiteaBot added modifies/go Pull requests that update Go code performance/cpu type/refactoring Existing code has been cleaned up. There should be no new functionality. labels Aug 20, 2024
@GiteaBot GiteaBot added this to the 1.22.2 milestone Aug 20, 2024
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 20, 2024
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 20, 2024
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 20, 2024
@silverwind silverwind enabled auto-merge (squash) August 20, 2024 17:09
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 20, 2024
@silverwind silverwind merged commit e536d18 into go-gitea:release/v1.22 Aug 20, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code performance/cpu size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants