question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

repo.Commits.QueryBy(filename) slow on large repos

See original GitHub issue

Reproduction steps

1): Clone a large repo 2): run this function on that repo with some random file:

public IEnumerable<string> TestSlow(string filename)
{
    using (var repo = new Repository(repoRoot))
    {
        string path = filename.Substring(repoRoot.Length + 1).Replace("\\", "/");
        foreach (LogEntry entry in repo.Commits.QueryBy(path))
        {
            yield return entry.Commit.Author.ToString();
        }
    }
}
  1. run this command on the same file: “git log --follow --oneline – <file>”

Expected behavior

I expect similar time to be taken by TestSlow and the git log command above

Actual behavior

The git log command finishes in about 1.6 ms on my repo The TestSlow command takes about 70 seconds.

Here is what I see in my profiler: profiler view

Version of LibGit2Sharp (release number or SHA1)

0.27.0-preview-0017 0.26.1 0.24.1

Operating system(s) tested; .NET runtime tested

.NET Framework 4.7.2 on Windows 10

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
blackboxlogiccommented, Oct 13, 2021

@Blueve Could you share your code for parsing the git.exe output?

1reaction
Bluevecommented, Feb 20, 2020

Awesome work! I met same issue and I have to wrap a git.exe and use git log to speed up the log reading.

Read more comments on GitHub >

github_iconTop Results From Across the Web

repo.Commits.QueryBy(filename) slow on large repos
Reproduction steps. 1): Clone a large repo 2): run this function on that repo with some random file:
Read more >
WHAT operations become slow when git repos ...
The answer is, most Git operations will get slower as the repo gets larger. But the operations which would make Git seem noticeably...
Read more >
RStudio slow with git when large subdirectory exists in ...
Problem: I have an RProject directory that contains files needed to write and compile a bookdown project. This directory is also a local ......
Read more >
Why is git add and git commit taking so long?
Large files: Adding and committing large files can take a long time, especially if they are binary files or if there are many...
Read more >
Git's database internals III: file history queries
The primary way to discover which commits recently changed a file is to use git log ... This can be extremely slow for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found