In the constructor of Repository, commits, branches, refs and tags are all loaded. In my case it makes LibGit2Sharp 4x slower than GitSharp. Please consider apply lazy loading everywhere to load data only needed. e.g.
public ReferenceCollection Refs
{
get
{
if (refs==null) refs = new ReferenceCollection(this);
return refs;
}
}
Listed below is the test case.
[TestMethod()]
public void RefsTest()
{
var tempFolder = ".......";
Stopwatch w = new Stopwatch();
w.Start();
for (int i = 0; i < 5000; i++)
{
var repository = new LibGit2Sharp.Repository(tempFolder);
foreach (var r in repository.Refs)
{
var k = r.CanonicalName;
}
repository.Dispose();
}
w.Stop();
Console.WriteLine("Time elapsed: {0}", w.Elapsed);
}
Thanks,
yysun
In the constructor of Repository, commits, branches, refs and tags are all loaded. In my case it makes LibGit2Sharp 4x slower than GitSharp. Please consider apply lazy loading everywhere to load data only needed. e.g.
Listed below is the test case.
Thanks,
yysun