Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Patrick Steinhardt <ps@pks.im>
Cc: Michael Montalbo <mmontalbo@gmail.com>,
	git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: weird quadratic reftable behavior, was: Re: [PATCH 3/3] t5551: pack refs after creating many tags
Date: Wed, 1 Jul 2026 04:00:14 -0400	[thread overview]
Message-ID: <20260701080014.GA3748390@coredump.intra.peff.net> (raw)
In-Reply-To: <akSxCUfm2P7ocLJX@pks.im>

On Wed, Jul 01, 2026 at 08:17:45AM +0200, Patrick Steinhardt wrote:

> This is a known issue, I think [1].
> 
> The problem here is the tombstoning: when you delete all references,
> chances are that they are not truly gone but that every reference is
> just tombstoned. The problem with this is that reading refs may now take
> signifciantly more time as we cannot just say "this stack is empty".
> Instead, we need to figure out that it is empty by processing all the
> tombstones, and that takes a lot of time.
> 
> I remember that I did some digging back then and improved the status quo
> quite significantly by optimizing `refs_verify_refname_available()`. I'm
> sure there are more opportunities for optimization here though -- I have
> a feeling that we for example exhaust the merged iterator until its end
> when searching for a specific refname, where we could easily abort once
> the observed tombstone name sorts lexicographically after the needle.

Yeah, it is (mostly) the same problem. About half the time is spent in
refs_verify_refnames_available().

The other half is in reftable_be_transaction_prepare(). Looks like it
makes individual calls to prepare_single_update(), which reads each ref.
And those reads are expensive because of all of the tombstones. It might
be possible to do an iterator merge or similar between the sorted list
of transaction refs and the reftable contents.

> But eventually I decided to not care too much about this edge case, as
> it seems very specific to this artificial benchmark scenario. Which of
> course doesn't mean that it's not worth doing, I just had bigger fish to
> fry and didn't get around to it yet.

Yeah, that's fair. I dug a bit further in case there was anything useful
to write up, but I don't have much to add beyond what's here and in the
thread you linked. We can let it live on in the archive for now.

-Peff

  reply	other threads:[~2026-07-01  8:00 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-20 15:33 [RFH] Why do osx CI jobs so unreliable? Michael Montalbo
2026-06-21 21:34 ` Jeff King
2026-06-22  4:42   ` Patrick Steinhardt
2026-06-22  9:47     ` Patrick Steinhardt
2026-06-22  9:55       ` Patrick Steinhardt
2026-06-22 10:29         ` Patrick Steinhardt
2026-06-26  3:27           ` Michael Montalbo
2026-06-26  5:16             ` Jeff King
2026-06-26 10:50               ` Patrick Steinhardt
2026-06-26 13:45                 ` Junio C Hamano
2026-06-26 23:26                 ` Michael Montalbo
2026-06-28  7:57                   ` [PATCH 0/3] fixing expensive http test timeouts Jeff King
2026-06-28  8:00                     ` [PATCH 1/3] t/lib-httpd: bump apache timeout Jeff King
2026-07-02  3:24                       ` Michael Montalbo
2026-06-28  8:03                     ` [PATCH 2/3] t5551: put many-tags case into its own repo Jeff King
2026-06-28 21:44                       ` Junio C Hamano
2026-06-29  0:34                         ` Jeff King
2026-06-29 14:42                           ` Junio C Hamano
2026-06-29 20:36                             ` Jeff King
2026-06-28  8:07                     ` [PATCH 3/3] t5551: pack refs after creating many tags Jeff King
2026-06-28 21:25                       ` Junio C Hamano
2026-06-29  5:57                       ` Patrick Steinhardt
2026-06-29 20:35                         ` Jeff King
2026-06-30  9:05                           ` Patrick Steinhardt
2026-06-30 23:47                             ` Jeff King
2026-06-30 23:58                               ` weird quadratic reftable behavior, was: " Jeff King
2026-07-01  6:17                                 ` Patrick Steinhardt
2026-07-01  8:00                                   ` Jeff King [this message]
2026-07-01  9:04                                     ` Kristofer Karlsson
2026-07-01 10:07                                       ` Patrick Steinhardt
2026-07-03 12:09                                         ` Kristofer Karlsson
2026-06-29  7:33                     ` [PATCH 0/3] fixing expensive http test timeouts Patrick Steinhardt
2026-06-29 14:39                       ` Junio C Hamano
2026-06-29 16:09                         ` Patrick Steinhardt
2026-06-29 16:19                           ` Junio C Hamano
2026-06-30  9:05                             ` Patrick Steinhardt
2026-06-30 19:21                               ` Junio C Hamano
2026-07-01  6:56                                 ` Patrick Steinhardt
2026-06-26 23:43                 ` [RFH] Why do osx CI jobs so unreliable? Jeff King
2026-06-22  5:05   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260701080014.GA3748390@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mmontalbo@gmail.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox