Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: git/git
base: 066f6cd44707ca2f8c3dc2a2ae02c2c9784903bf
Choose a base ref
...
head repository: git/git
compare: 3e5e6c6e94f09973d3a72049aad09fd2131a3648
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Aug 4, 2021

  1. fetch-pack: speed up loading of refs via commit graph

    When doing reference negotiation, git-fetch-pack(1) is loading all refs
    from disk in order to determine which commits it has in common with the
    remote repository. This can be quite expensive in repositories with many
    references though: in a real-world repository with around 2.2 million
    refs, fetching a single commit by its ID takes around 44 seconds.
    
    Dominating the loading time is decompression and parsing of the objects
    which are referenced by commits. Given the fact that we only care about
    commits (or tags which can be peeled to one) in this context, there is
    thus an easy performance win by switching the parsing logic to make use
    of the commit graph in case we have one available. Like this, we avoid
    hitting the object database to parse these commits but instead only load
    them from the commit-graph. This results in a significant performance
    boost when executing git-fetch in said repository with 2.2 million refs:
    
        Benchmark #1: HEAD~: git fetch $remote $commit
          Time (mean ± σ):     44.168 s ±  0.341 s    [User: 42.985 s, System: 1.106 s]
          Range (min … max):   43.565 s … 44.577 s    10 runs
    
        Benchmark #2: HEAD: git fetch $remote $commit
          Time (mean ± σ):     19.498 s ±  0.724 s    [User: 18.751 s, System: 0.690 s]
          Range (min … max):   18.629 s … 20.454 s    10 runs
    
        Summary
          'HEAD: git fetch $remote $commit' ran
            2.27 ± 0.09 times faster than 'HEAD~: git fetch $remote $commit'
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Aug 4, 2021
    Copy the full SHA
    3e5e6c6 View commit details
    Browse the repository at this point in the history