git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/4] Improve performance of reflog expiration

From
Toon Claes <toon@iotcl.com>
Date
Nov 18, 2026, 15:56 UTC
Message-ID
<87bj7mjfp2.fsf@dev.null.iotcl.com.invalid>
In-Reply-To
<20261118-pks-reflog-expire-performance-v1-0-10b9263566a8@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 16 quoted lines
> Hi,
>
> I recently noticed that a bunch of commands started hanging for almost a
> second after they're essentially done already. As it turns out, this was
> caused by auto-maintenance, which was blocking in the foreground for
> ~800ms.
>
> The root cause of this is that the auto-condition of "reflog-expire"
> doesn't properly evaluate reachability of reflog entries, so it instead
> considered every single reflog entry to point to an unreachable commit.
> Hence, all entries were evaluated against "gc.reflogExpireUnreachable"
> instead of "gc.reflogExpire", and thus the auto-condition significantly
> overcounts the number of entries that we'd prune. So every single run of
> git-maintenance(1) ultimately ended up spawning `git reflog expire`.
>
> This is fixed by the last patch in this series.
Well, the last one is a doc change, but I get what you mean.
Show 21 quoted lines
> But I was a bit
> surprised that a no-op `git reflog expire` took this long, so the first
> two patches optimize the reftable backend to be more efficient, too.
> In my copy of "git.git":
>
>   Benchmark 1: git maintenance run --auto (commit = master) (10 runs)
>                   mean     ±       σ          min     …     max
>     Wall Time    853.2 ms  ±    99.9 ms     570.9 ms  …   901.9 ms
>     Memory       117.5 MiB ±     0.3 MiB    117.2 MiB …   118.2 MiB
>
>   Benchmark 2: git maintenance run --auto (commit = reftable-optimizations) (10 runs)
>                   mean     ±       σ          min     …     max
>     Wall Time    392.3 ms  ±     2.3 ms     388.0 ms  …   396.6 ms           -54.0%  (2.2x faster)
>     Memory       117.2 MiB ±     0.2 MiB    116.8 MiB …   117.4 MiB           -0.2%
>
>   Benchmark 3: git maintenance run --auto (commit = auto-condition-optimizations) (10 runs)
>                   mean     ±       σ          min     …     max
>     Wall Time     18.6 ms  ±     1.1 ms      17.4 ms  …    20.9 ms           -97.8%  (45.8x faster)
>     Memory        81.2 MiB ±     0.1 MiB     80.9 MiB …    81.4 MiB          -30.9%  (1.4x less)
>
> So yeah, it's a bit more efficient now. :)

Great work. I only had one remark on consistency, but not really worth a reroll in itself if you ask me.

-- 
Laters,
Toon
Previous: Toon ClaesNext: Patrick Steinhardt
Message 17 of 18 in “Improve performance of reflog expiration”
  1. 0/4 Improve performance of reflog expirationPatrick Steinhardt, Nov 18, 2026
  2. 1/4 refs/reftable: don't write new table on dry-run expirePatrick Steinhardt, Nov 18, 2026
  3. Karthik NayakNov 18, 2026
  4. Patrick SteinhardtNov 18, 2026
  5. Junio C HamanoNov 18, 2026
  6. Patrick SteinhardtNov 19, 2026
  7. 2/4 refs/reftable: don't write new table when expire is a no-opPatrick Steinhardt, Nov 18, 2026
  8. Karthik NayakNov 18, 2026
  9. Patrick SteinhardtNov 18, 2026
  10. Toon ClaesNov 18, 2026
  11. Patrick SteinhardtNov 19, 2026
  12. 3/4 builtin/maintenance: only consider `gc.reflogExpire` for "--auto"Patrick Steinhardt, Nov 18, 2026
  13. Toon ClaesNov 18, 2026
  14. Patrick SteinhardtNov 19, 2026
  15. 4/4 Documentation/config: fix typo in "maintenance.reflog-expire.auto"Patrick Steinhardt, Nov 18, 2026
  16. Toon ClaesNov 18, 2026
  17. Toon ClaesNov 18, 2026
  18. Patrick SteinhardtNov 19, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.