Environment:
libgit2sharp version: 0.24.1 from NuGet
.NET version: 4.5
OS: Windows 7, 32 bit.
CPU: Intel Core i7 @ 1.8 GHz.
storage: local SSD
Test case:
- Clone a large Git repo. (I try with https://github.com/python/cpython ).
- Run git log example on this repo.
Expected results:
Should be almost instant, because of "Take(15)" is limiting to just 15 commits.
The time should be similar to running git log -15 | cat from command line, which is almost instant to me.
Actual results:
It takes about 1.5-2 seconds to start iterating over the commits.
Notes:
The iteration time doesn't change significantly if you change to Take(10000) or Take(3).
It seems that it reads the entire history (or a huge chunk of it) into memory before the iteration starts.
If have changed the test sample to sleep after every 1000 items. It has shown that there's almost no significant delay for reading over the first 10K after it gets to the first item.
The task manager shows that my process takes about 6 Mb before the loop starts, and about 80 Mb on the first line of the loop (Console.WriteLine) right after it starts, which also indicates that.
Also this is a screenshot of the .NET profiler that shows that the most of the time is spent inside NativeMethods.git_revwalk_next, which I don't know how to profile inside (is it a C function?).

Question: Is there a workaround? I would like to get a few commits really fast by something like Commits.Skip(N).Take(50). Is there an alternative API that can be used for this use case? Is there a setting somewhere that tweaks how much of the history does it load/preload internally?
Environment:
libgit2sharp version: 0.24.1 from NuGet
.NET version: 4.5
OS: Windows 7, 32 bit.
CPU: Intel Core i7 @ 1.8 GHz.
storage: local SSD
Test case:
Expected results:
Should be almost instant, because of "Take(15)" is limiting to just 15 commits.
The time should be similar to running
git log -15 | catfrom command line, which is almost instant to me.Actual results:
It takes about 1.5-2 seconds to start iterating over the commits.
Notes:
The iteration time doesn't change significantly if you change to Take(10000) or Take(3).
It seems that it reads the entire history (or a huge chunk of it) into memory before the iteration starts.
If have changed the test sample to sleep after every 1000 items. It has shown that there's almost no significant delay for reading over the first 10K after it gets to the first item.
The task manager shows that my process takes about 6 Mb before the loop starts, and about 80 Mb on the first line of the loop (Console.WriteLine) right after it starts, which also indicates that.
Also this is a screenshot of the .NET profiler that shows that the most of the time is spent inside
NativeMethods.git_revwalk_next, which I don't know how to profile inside (is it a C function?).Question: Is there a workaround? I would like to get a few commits really fast by something like
Commits.Skip(N).Take(50). Is there an alternative API that can be used for this use case? Is there a setting somewhere that tweaks how much of the history does it load/preload internally?