Optimize the ListLastCommitsForTree RPC to do less work
The following discussion from !881 (merged) should be addressed:
-
@nick.thomas started a discussion: (+2 comments) Optimization talk: we could look up the last commit ID here, then bulk-lookup all the commits by ID, which saves `N- @tiagonbotelho no, I'm thinking about the work log.LastCommitForPath does. We're calling it once per path. Each time, it run git log to get the most recent commit ID that touches a path. Then, it runs git show to convert that commit ID to a Commit object. That is what we return to the client.
Instead, we could:
Still run git log once per path, collecting the IDs into a map of path -> id
Deduplicate the list of commit IDs so that if 10 paths point at the same commit, we only have a single ID to look up Run git show just once, with the full list of commit IDs, to get the commits we want Return exactly the same result to the client, but with less work