libgit2 / libgit2/libgit2sharp

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

オープン
#1,705 コメント 6 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C#
スター
3.5k
フォーク
925
PR マージ指標
30日以内にマージされた PR はありません

説明

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 -- "
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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、大規模なリポジトリで、repo.Commits.QueryBy(path) を使用する TestSlow と git log --follow --oneline -- <file> の比較を再現します。報告された profiler の表示と計測時間を使って、QueryBy がどこで時間を費やしているかを特定します。返される commit エントリを維持しながら、大規模なリポジトリでの実行時間を比較対象の git コマンドに近づけるまで短縮できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp, git
領域
performance
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。