#2126 When diffing the branches, do not browse master all the time, once is enough
Merged by pingou. Opened by pingou.
lookup_optimization  into  master

Download 2126.patch

We used to iterate through the branches, then browse master/HEAD then
browse the branch to see if it has commits that aren't in master/HEAD.
With this commit, we'll browse master/HEAD just once at the start, then
iterate through the branches, skip the branch that is equivalent to
master/HEAD and check the other to see if they have commits not present
in master.

There is no need for this.
Most of the comparing stops after a few commits, meaning that getting a full list of everything in master is a waste.

1 new commit added

  • Only iterate through master if there are more than one branch

2 new commits added

  • Exclude the commit shared between the branches from the diff list
  • Optimize diffing two branches

1 new commit added

  • Small clean up

I'll be looking at re-using this same algorithm when diffing PRs

Here is a patch making the tests pass for me :)

https://paste.fedoraproject.org/paste/hKh4OyT~ISFmhmDFS-e--F5M1UNdIGYhyRLivL9gydE=

This drops the number of walks + steps significantly, so performance +1.
Change itself also looks good to me.

rebased

Thanks for the review!

Pull-Request has been merged by pingou

Metadata