git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] builtin/remote: rework how remote refs get renamed
@ 2025-07-28 13:08 Patrick Steinhardt
  2025-07-28 13:08 ` [PATCH 1/4] refs: pass refname when invoking reflog entry callback Patrick Steinhardt
                   ` (5 more replies)
  0 siblings, 6 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-07-28 13:08 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Jeff King, Han Jiang

Hi,

this patch series is the result from the discussion at [1]. On the one
hand this series fixes the reported bug where dangling symrefs are not
renamed via `git remote rename`.

On the other hand this series reworks the logic used to rename remotes
so that we use two transactions instead of one transaction per ref. This
fixes quadratic runtime behaviour, where renaming 10k refs takes ~4
minutes, 100k takes hours. This results in a significant speedup with
both the "files" backend (benchmarked with a smaller number of refs to
retain sanity):

    Benchmark 1: rename remote (refformat = files, revision = HEAD~)
      Time (mean ± σ):     238.770 s ± 13.857 s    [User: 91.473 s, System: 143.793 s]
      Range (min … max):   204.863 s … 247.699 s    10 runs

    Benchmark 2: rename remote (refformat = files, revision = HEAD)
      Time (mean ± σ):      2.103 s ±  0.036 s    [User: 0.360 s, System: 1.313 s]
      Range (min … max):    2.011 s …  2.141 s    10 runs

    Summary
      rename remote (refformat = files, revision = HEAD) ran
      113.53 ± 6.87 times faster than rename remote (refformat = files, revision = HEAD~)

For the "reftable" backend we see a significant speedup, as well, but
not as extreme as with the "files" backend:

    Benchmark 1: rename remote (refformat = reftable, revision = HEAD~)
      Time (mean ± σ):      8.604 s ±  0.539 s    [User: 4.985 s, System: 2.368 s]
      Range (min … max):    7.880 s …  9.556 s    10 runs

    Benchmark 2: rename remote (refformat = reftable, revision = HEAD)
      Time (mean ± σ):      1.177 s ±  0.103 s    [User: 0.446 s, System: 0.270 s]
      Range (min … max):    1.023 s …  1.410 s    10 runs

    Summary
      rename remote (refformat = reftable, revision = HEAD) ran
        7.31 ± 0.79 times faster than rename remote (refformat = reftable, revision = HEAD~)

But in any case, it's one more case where the "reftable" backend
outperforms the "files" backend.

The series is built on top of e4ef0485fd7 (The fourteenth batch,
2025-07-24) with ps/reflog-migrate-fixes at de7cc0782a7 (refs: fix
invalid old object IDs when migrating reflogs, 2025-07-25) merged into
it.

I'd normally have withheld sending until that series was merged to
"next", but given that I promised to send something on Friday already I
decided to just get it out. In any case, if that causes problems I'm
happy to wait a bit before this series here gets merged into "seen".

Thanks!

Patrick

[1]: <CANrWfmQWa=RJnm7d3C7ogRX6Tth2eeuGwvwrNmzS2gr+eP0OpA@mail.gmail.com>

---
Patrick Steinhardt (4):
      refs: pass refname when invoking reflog entry callback
      refs: simplify logic when migrating reflog entries
      builtin/remote: rework how remote refs get renamed
      builtin/remote: only iterate through refs that are to be renamed

 builtin/fsck.c            |   9 +-
 builtin/gc.c              |   3 +-
 builtin/remote.c          | 275 ++++++++++++++++++++++++++++++----------------
 builtin/stash.c           |   6 +-
 commit.c                  |   3 +-
 object-name.c             |   3 +-
 reflog-walk.c             |   7 +-
 reflog.c                  |   3 +-
 reflog.h                  |   3 +-
 refs.c                    |  63 +++++------
 refs.h                    |   3 +

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2025-08-04 18:24 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-28 13:08 [PATCH 0/4] builtin/remote: rework how remote refs get renamed Patrick Steinhardt
2025-07-28 13:08 ` [PATCH 1/4] refs: pass refname when invoking reflog entry callback Patrick Steinhardt
2025-07-28 15:59   ` Justin Tobler
2025-07-28 16:07   ` Junio C Hamano
2025-07-29 20:30   ` Karthik Nayak
2025-07-31  8:28     ` Patrick Steinhardt
2025-07-28 13:08 ` [PATCH 2/4] refs: simplify logic when migrating reflog entries Patrick Steinhardt
2025-07-28 16:08   ` Justin Tobler
2025-07-28 16:21   ` Junio C Hamano
2025-07-28 13:08 ` [PATCH 3/4] builtin/remote: rework how remote refs get renamed Patrick Steinhardt
2025-07-28 17:19   ` Junio C Hamano
2025-07-29  8:43     ` Patrick Steinhardt
2025-07-28 18:47   ` Justin Tobler
2025-07-28 18:57     ` Junio C Hamano
2025-07-29  8:43       ` Patrick Steinhardt
2025-07-29  8:16   ` Jeff King
2025-07-29 12:24     ` Patrick Steinhardt
2025-08-02 10:48       ` Jeff King
2025-07-28 13:08 ` [PATCH 4/4] builtin/remote: only iterate through refs that are to be renamed Patrick Steinhardt
2025-07-28 17:43   ` Junio C Hamano
2025-07-30  7:53   ` Karthik Nayak
2025-07-31  8:28     ` Patrick Steinhardt
2025-07-28 15:43 ` [PATCH 0/4] builtin/remote: rework how remote refs get renamed Junio C Hamano
2025-07-31 14:56 ` [PATCH v2 0/6] " Patrick Steinhardt
2025-07-31 14:56   ` [PATCH v2 1/6] refs: pass refname when invoking reflog entry callback Patrick Steinhardt
2025-07-31 14:56   ` [PATCH v2 2/6] refs: simplify logic when migrating reflog entries Patrick Steinhardt
2025-07-31 14:56   ` [PATCH v2 3/6] builtin/remote: fix sign comparison warnings Patrick Steinhardt
2025-07-31 14:56   ` [PATCH v2 4/6] builtin/remote: determine whether refs need renaming early on Patrick Steinhardt
2025-07-31 14:56   ` [PATCH v2 5/6] builtin/remote: rework how remote refs get renamed Patrick Steinhardt
2025-08-02 10:45     ` Jeff King
2025-08-04  6:54       ` Patrick Steinhardt
2025-07-31 14:56   ` [PATCH v2 6/6] builtin/remote: only iterate through refs that are to be renamed Patrick Steinhardt
2025-07-31 19:15   ` [PATCH v2 0/6] builtin/remote: rework how remote refs get renamed Junio C Hamano
2025-08-01  4:59     ` Patrick Steinhardt
2025-08-01 16:43       ` Junio C Hamano
2025-08-04  6:51         ` Patrick Steinhardt
2025-08-04 18:24           ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).