New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance regression when reading files from the tree in parallel #2076
Comments
I did another |
That was two and a half years ago. A lot has changed since then. It's going to be tricky to isolate the problem. One question to start - what's the perf if you have one repository per thread instead of sharing the repository across threads? |
Thanks for your reply!
You mean one |
Spot on! Using one |
Right — really good question. I was mostly hoping to stem the bleeding and get you to a performant situation. Digging in to the why it's slow would be really interesting. https://github.com/libgit2/libgit2/blob/main/docs/threading.md#sharing-objects has a bit of a discussion about libgit2's threading policy (which LibGit2Sharp should also document as it should be identical — I don't think that there's anything in LibGit2Sharp that makes threading any different). Without actually doing a serious investigation: probably you're hitting a lock on an object cache. Why that got worse, I don't know, and we should 👀 that. But the most performant way to do what you're doing is multiple |
Thanks again for your insight.
👍🏻
Should we move this issue to https://github.com/libgit2/libgit2?
Alright! |
Reproduction steps
CommitFixture.cs
:CanReadCommitParallel
takes 1417ms andCanReadCommit
takes 2971ms (which is fine)CanReadCommitParallel
takes 3731ms andCanReadCommit
takes 3250ms!Expected behavior
Reading files in parallel should be faster than reading files sequentially from the git tree.
Actual behavior
It seems that reading files from the tree in parallel (multi-thread) is not faster. I did a
git bisect
and it seems that this regression was introduced in 21d4f13Version of LibGit2Sharp (release number or SHA1)
Versions after 21d4f13
Operating system(s) tested; .NET runtime tested
.NET 6 and .NET 7.
The text was updated successfully, but these errors were encountered: