Community
Participate
Working Groups
In a large repository, it may takes a few seconds to list and filter commit history. We inspected the stack traces for command git log --before=xxxxx with CPU Profiler. Here are a few of stack traces with some hot spots identified, the left of the line is the percent of total cpu time. |--99.1% o.e.j.Mytest.testLinuxLog `--97.1% o.e.j.revwalk.RevWalk.iterator `--97.1% o.e.j.revwalk.RevWalk.nextForIterator `--97.1% o.e.j.revwalk.RevWalk.next `--97.1% o.e.j.revwalk.PendingGenerator.next `--94.9% o.e.j.revwalk.RevCommit.parseHeaders |--86.1% o.e.j.revwalk.RevWalk.getCachedBytes `--8.6% o.e.j.revwalk.RevCommit.parseCanonical When filtering the commit history, JGit always invokes the method o.e.j.revwalk.RevWalk.getCachedBytes to get the entire infomation of the commit ( It takes over 85% in the stacke traces above ). Git had to go looking for where the commit was stored, decompress the commit file, and parse the commit in plain-text. This can be expensive, especially when doing it thousands of times. The commit-graph can help with this problem. It is a supplemental data structure that accelerates commit graph walks ( E.g. listing and filtering commit history, computing merge-base....). see https://git-scm.com/docs/commit-graph https://devblogs.microsoft.com/devops/supercharging-the-git-commit-graph/ https://devblogs.microsoft.com/devops/supercharging-the-git-commit-graph-ii-file-format/ https://devblogs.microsoft.com/devops/supercharging-the-git-commit-graph-iii-generations/ https://devblogs.microsoft.com/devops/super-charging-the-git-commit-graph-iv-bloom-filters/
Our company have been implementing this feature based on JGit for a long while to improve the performance of commit graph walks. And it's already used in some of our git repositories. we test it on https://github.com/torvalds/linux, and the following is the performance number with this change. cmmand | berfore | after | change git log --before=2009-1-1 | 4790ms | 589ms | -87% git merge-base master topic | 483ms | 58ms | -88% master: 032b4cc8ff84490c4bc7c4ef8c91e6d83a637538 topic: 62d18ecfa64137349fac9c5817784fbd48b54f48 We are willing to contribute our code to the community, and hope someone can review it. Regards, Kyle Zhao
(In reply to Kyle Zhao from comment #1) > Our company have been implementing this feature based on JGit for a long > while to improve the performance of commit graph walks. And it's already > used in some of our git repositories. > > we test it on https://github.com/torvalds/linux, and the following is the > performance number with this change. > > cmmand | berfore | after | change > git log --before=2009-1-1 | 4790ms | 589ms | -87% > git merge-base master topic | 483ms | 58ms | -88% that's a nice speedup > master: 032b4cc8ff84490c4bc7c4ef8c91e6d83a637538 > topic: 62d18ecfa64137349fac9c5817784fbd48b54f48 > > We are willing to contribute our code to the community, and hope someone can > review it. sure, please contribute it Looking forward to reviewing your implementation.
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/182832
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/182892
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/182976
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/183078
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/183079
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/187541
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/197097
Gerrit change https://git.eclipse.org/r/c/jgit/jgit/+/182832 was merged to [master]. Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=cf70e7cbe4fffabf1caebbf4b8705188957cfa6a
Gerrit change https://git.eclipse.org/r/c/jgit/jgit/+/182892 was merged to [master]. Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=7b0f633b675863c30c2cd4f192e49137a3950e50
Gerrit change https://git.eclipse.org/r/c/jgit/jgit/+/182976 was merged to [master]. Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=b082c58e0ff3e829071e90b47df022e77cd3dea2
Gerrit change https://git.eclipse.org/r/c/jgit/jgit/+/183078 was merged to [master]. Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=8a7348df6966da39c1402c8f51fa4f7a9aeb8e7e
Gerrit change https://git.eclipse.org/r/c/jgit/jgit/+/183079 was merged to [master]. Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=de7d06775c5cf071fb5a14b19d230f5e0845b9ef
Gerrit change https://git.eclipse.org/r/c/jgit/jgit/+/187541 was merged to [master]. Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=5cc9ecde8f9de1b48f90a59160a71cf108a984b2