mirror of
https://github.com/go-gitea/git.git
synced 2026-07-25 12:46:00 -04:00
[PR #91] [MERGED] Faster commit lookup #97
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/go-gitea/git/pull/91
Author: @ethantkoenig
Created: 11/18/2017
Status: ✅ Merged
Merged: 12/10/2017
Merged by: @lafriks
Base:
master← Head:fast_commits📝 Commits (4)
489f7b0Faster commit lookupe39b29fFix copy/rename bug2706f5eCommentacb3e0fUse defer📊 Changes
4 files changed (+366 additions, -168 deletions)
View changed files
➕
commit_info.go(+307 -0)➕
commit_info_test.go(+59 -0)📝
tree_entry.go(+0 -114)📝
tree_entry_test.go(+0 -54)📄 Description
A faster implementation of
GetCommitsInfo, particularly for repositories with many files. Addresses https://github.com/go-gitea/gitea/issues/491 and https://github.com/go-gitea/gitea/issues/502.A revival of the failed #53 (which was reverted by #73).
BENCHMARKS
Old implementations:
New implementation:
In summary, we see a >150x improvement in repos with many files, and mild improvements in other repos.
IMPLEMENTATION DETAILS:
Runs targeted and untargeted searches in parallel. The untargeted search (1 thread) sifts through the output of a
git log --name-status -c -- <tree-path>command, seeing which files the most recent commits have affected. The targeted search (multiple threads) runsgit rev-list -1 HEAD -- <entry>commands to get the latest commit for specific file that have not been found by the untargeted search. The targeted search is similar to the old implementation, with a few enhancements (e.g. usesgit rev-listinstead ofgit log).If there are only a few remaining entries, then the untargeted search stops to allow the targeted-search threads to finish without any interference (in my tests, this interference had a non-negligible impact on performance).
TESTING:
I have not been able to test this new implementation on a Windows machine. If someone could test the new implementation on Windows (to check for forward-slash vs. backslash bugs), that would be great.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.