Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Performance Improvement #28
Hey Phil Haack! I love this project and have found it to be a great tool for visualizing our local Git repos. I noticed that strarting up the application would take a while, especially if there were a few merged branches. I added this section of code and compared the results of our local repos along with your SeeGit repo and the visual graph matches. For your SeeGit repo, AddCommitsToGraph was cut down from 94,199 calls to 108.
Let me know what you think!
That's a good point. In that case, would you keep the else since the if would just return? Example:
As for the reason. For each branch in the graph it will ask to add an edge from commit A to commit B and from commit A to commit C (given that A was a merge of B and C). When the ancestors of B and C come back to D (given that D is a common ancestor of B and C) then both B and C have started a graph walk and will walk the graph twice. The larger the repository, the worse this would become.
So, using A, B, C and D from above, and introducing E (where E is an ancestor of D) then this code states "If you've already added an edge from D to E (perhaps A -> B -> D -> E) then we don't need to walk the graph past E (perhaps A -> C -> D -> E)."
I hope I have this correct. Also, I would love to contribute more to this project if it's alright with you!