-
Notifications
You must be signed in to change notification settings - Fork 887
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
make TargetId of TreeEntry public #231
Conversation
Signed-off-by: Gorbach Alexey <gorbach.alexey@gmail.com>
Hey @gorbach. Glad to see you back! Have you experienced some performance related issue in this area? Is it what motivated this PR? Indeed, being able to access the ObjectId of the target without being compelled to load it would provide the consumer with a nice speed bump. And I agree with you, we should try to make this happen. However, I'm not sure about merging this PR in its current state.
So, I was thinking about a slightly different approach (greatly inspired by the work you've performed with the How about tweaking every How does that sound? Feasible? |
Hi @nulltoken ! Glad to see you too! We are working on a new version of GitExtenstions, which is going to use libgit2sharp for most of it git access. The problem, that I faced with is a performance problem. Here are some more details. The method gets list of TreeEntries. GitExtensions need the name of the entry, it's type, Id and filename. The old implementation was like this:
The new one (without using TreeId) was like this:
Implementation using TargetId is almost the same, but instead of Guid = t.Target.Sha use Guid = t.TargetId.Sha. In terms of the performance GetTreeNew method with t.Target.Sha executes about 2.8 ms, but most of the time( 2.7 ms ) spends in looking up itself, while result is not needed. So the last one implementation is much faster. About implementation. Of cause, I'll fix unit test, but I'm not sure too, if this solution fits overall design of libgit2sharp. The current API is more clear, but has some performance issues :(. Your suggestion is looking very attractive, but I'm not sure if it easy to implement, Do we need some kind of proxy, that intercepts all call to object properties? |
@gorbach I've paired with @yorah on this topic. nulltoken/libgit2sharp@7a9721e0d98088bbeef09d9427f0a67a2ca1e998 is the best approach we've been able to come up with considering the usual performance/readability/usability factors...
Feel free to shoot at it, improve.... /cc @dahlbyk |
@gorbach I've updated the spike. Check the nulltoken/lazy-groups branch |
Rebound: https://github.com/dahlbyk/libgit2sharp/compare/lazy-groups Big take-away is that an interface removes the need for the base class. It strikes me as odd that |
I love it! 👍 |
I can't play with it atm, but it looks like a very elegant approach! 👍 |
Guys, I'm more and more sold on this ´GitObject´ types redesign proposal.
This should provide @gorbach with a little speed bump without cluttering the API. Is there anyone willing to take a stab at a full featured PR? Warning, there may be dragons out there ;-) |
https://github.com/nulltoken/libgit2sharp/tree/231_spike @dahlbyk could you please peek at this? Also, I've slightly upgraded the @gorbach How does it look to you? |
The lazy group level implementation looks good, but I wonder about the performance impact. Since enumerating over commit info, in particular, is a common operation, the overhead might not be worth the (IMO) minor readability improvement in And if |
Come to think of it, |
Sadly, we're supposed to be compatible with the .Net 4.0 type |
As |
I guess since we return |
Ok. Are you willing to give it a stab? |
Grmpff. I'm starting to hate you 😉
|
|
I ask because I care |
Sure |
Thank you so much for this ... and for being such an awesome reviewer! 💖 |
nulltoken:231_spike...dahlbyk:231_spike
|
Or reducing a bit of noise... |
@dahlbyk How about this? https://github.com/nulltoken/libgit2sharp/commits/231_spike |
👍 |
Merged into |
I'm not sure if I'm right, but when I have a repository with a sub module, then there is a tree entry of type Commit. Accessing treeEntry.Target.Sha throws an exception: TreeEntry target of type 'Commit' are not supported. Hence having access to the ObjectId directly would be nice. |
/cc #312 |
bf7c434 adds a test for this in the context of new Submodule support. If you need the fix now, you can cherry-pick just the |
@choffmeister |
No description provided.