Re: [PATCH] commit-reach: fix sorting commits by generation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/23/2018 4:32 PM, Thomas Gummerer wrote:
On 10/22, René Scharfe wrote:
Am 22.10.2018 um 23:10 schrieb Thomas Gummerer:

Anyway, your implied question was discussed back then.  Derrick wrote:

    The reason to sort is to hopefully minimize the amount we walk by
    exploring the "lower" commits first. This is a performance-only thing,
    not a correctness issue (which is why the bug exists). Even then, it is
    just a heuristic.
Thanks for pointing that out!

Does b6723e4671 in pu (commit-reach: fix first-parent heuristic) change
that picture?  Did a quick test and found no performance difference with
and without the fix on top, i.e. proper sorting didn't seem to matter.
I just gave 'test-tool reach can_all_from_reach' a try and got the
same results, with or without the fix the times are very similar.  I
haven't had time to follow the commit-graph series though, so I'm not
sure I used it correctly.

Thanks for your attention here. I've been thinking a lot about this heuristic and have concluded the following two things are true:

(1) When we return 1, the order that we explore the 'from' commits does not change the explored set of commits.

(2) When we return 0, the order that we explore the 'to' commits will change the explored set, but it is difficult to say that the heuristic helps more than it hurts.

Item (1) is contrary to what I had thought when I first created the heuristic.

The details are tricky, but essentially each DFS starting at a 'from' commit may be short-circuited due to a prior walk, but swapping the order of those two 'from' commits would lead to the same set of commits to be explored (with the short-circuit happening in the other commit). The only change is that we can terminate early if we fully explore a 'from' commit and do not find a commit marked with 'with_flag'. In this sense, it would be best to explore the commits that are "closest" to the generation number cutoff first, as we can maybe find a negative answer earlier in the search.

In this sense, we could remove the sort entirely and probably not have much performance hit. But since the set of 'from' commits is probably much smaller than the set of commits to explore, the sort is likely inexpensive.

In conclusion: I cannot say that this sort is super-important. As for the potential benefits in (2), I'll leave that to people who run git as a server who may have telemetry around fetch negotiation. How often do we actually say we need more rounds of negotiation? What kinds of data shapes matter there?

Thanks,
-Stolee



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux