Skip to content

repository: Speed up replication via `--no-tags`

Patrick Steinhardt requested to merge pks-replication-speed-up-via-no-tags into master

By default, git-fetch(1) will always do two fetch passes: a first pass to fetch normal references, and then a second fetch for all tags that may point into the just-fetched history. This of course takes time to compute. The following benchmark has been executed in linux.git with stable tags and a separate keep-around reference for every single commit:

Benchmark 1: git fetch refs/*:refs/*
  Time (mean ± σ):     14.825 s ±  0.087 s    [User: 9.435 s, System: 6.526 s]
  Range (min … max):   14.752 s … 14.922 s    3 runs

Benchmark 2: git fetch refs/*:refs/* --no-tags
  Time (mean ± σ):     13.073 s ±  0.145 s    [User: 7.794 s, System: 6.400 s]
  Range (min … max):   12.911 s … 13.190 s    3 runs

Summary
  git fetch refs/*:refs/* --no-tags ran
    1.13 ± 0.01 times faster than git fetch refs/*:refs/*

So even though we already ask Git to fetch all references, explicitly adding --no-tags causes a non-negligible performance improvement even though it should ultimately end up being a no-op.

Let's reap this performance benefit in our replication. As we already use a forced mirror refspec we know that we'd fetch tags regardless of whether they point into fetched history or not. So we lose nothing while gaining some speed.

Merge request reports