-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Increase commits listing page speed #217
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
Comments
Preferably the entire |
@denji I've personally used |
sourcegraph used Suggestion is to disable the default, use the minimum size, and optional hybrid/adaptive use big-cache (config) |
So these days the commit list page doesn't seem to be too costly. I'm guessing that the But the cost does hit the first time you load the summary page for the repository, and it costs about 6 seconds for a mirror of linux.git. Also pushing can be super expensive. I've started carrying this patch in my build of gitea, for testing purposes: diff --git a/vendor/code.gitea.io/git/commit.go b/vendor/code.gitea.io/git/commit.go
index 299a2381..7ed71c27 100644
--- a/vendor/code.gitea.io/git/commit.go
+++ b/vendor/code.gitea.io/git/commit.go
@@ -10,7 +10,6 @@ import (
"container/list"
"fmt"
"net/http"
- "strconv"
"strings"
)
@@ -158,19 +157,7 @@ func CommitChanges(repoPath string, opts CommitChangesOptions) error {
}
func commitsCount(repoPath, revision, relpath string) (int64, error) {
- var cmd *Command
- cmd = NewCommand("rev-list", "--count")
- cmd.AddArguments(revision)
- if len(relpath) > 0 {
- cmd.AddArguments("--", relpath)
- }
-
- stdout, err := cmd.RunInDir(repoPath)
- if err != nil {
- return 0, err
- }
-
- return strconv.ParseInt(strings.TrimSpace(stdout), 10, 64)
+ return 0, nil
}
// CommitsCount returns number of total commits of until given revision. With the above patch, pushing a full mirror of linux.git goes from this:
To this:
So that's a couple orders of magnitude improvement, and with no real loss as far as I'm concerned (what does one use the commit counts for, anyway?) Maybe calculating the commit counts should be a background job that gets cached until the next repo modification? I really shouldn't be forced to sit there for ages waiting for a push to complete just because it has to count revisions on every tag or branch I push. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions. |
A linux repository with 798649 commits will spent 5313ms on the first commits list page. |
Closing as we've gotten the linux kernel to load fairly quickly these days. |
Description
commits listing page (eg : https://127.0.0.1:3000/torvalds/linux-kernel/commits/master) could be speed up by stopping to dump whole git repository commits at each page by using
--max-count
and--skip
arguments with the commandgit rev-list
.Relative to #3818, Linux kernel repository count more than 600K commits and it could be nice to avoid dumping whole commits at each page if this is not necessary.
Or maybe cache usage could be a viable alternative to avoid running this command at each page (even if no modifications has been done on the repo)
More information at gogs/gogs#3830 (comment)
The text was updated successfully, but these errors were encountered: