From: Jeff King <peff@peff•net>
To: Junio C Hamano <gitster@pobox•com>
Cc: "René Scharfe" <l.s.r@web•de>, "Git List" <git@vger•kernel.org>
Subject: Re: [PATCH] describe: use khash in finish_depth_computation()
Date: Mon, 25 Aug 2025 23:39:20 -0400 [thread overview]
Message-ID: <20250826033920.GA388997@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqqcy8jqlue.fsf@gitster.g>
On Mon, Aug 25, 2025 at 11:48:09AM -0700, Junio C Hamano wrote:
> Jeff King <peff@peff•net> writes:
>
> > So out of curiosity I tried replacing a slab that should be pretty
> > densely filled, using a khash based on oidhash/ptr along with some
> > quality-of-life wrappers. Patch is below.
> >
> > It performs...very badly. Not sure if I've screwed something up, but
> > it's about 7x slower to run "git rev-list --author-date-order HEAD" in
> > the kernel. So maybe slabs really are worth it overall.
>
> Hmph. It is the best case scenario for the slab code, as you'd need
> author date for each and every commit object in this use case, and
> the comparison function called by prio-queue would be called for the
> same object many times.
>
> But the hash function being oidhash(), I am a bit surprised. It
> shouldn't be so much more expensive to peek at the first 4 bytes and
> then do the usual hashtable thing than looking at the in-object
> commit->index. Is it a sign that the range of oidhash() is a bit
> too small for a real workload?
>
> Nah, 4 byte unsigned integer should be sufficient for the number of
> objects in the kernel.
I was surprised, too. I expected it be maybe 20% slower or something.
Which really makes me think I've managed to screw up the patch, but if
so, I don't see it. I tried profiling the result, expecting to see a
bunch of extra time spent in obj_timestamp_put() or obj_timestamp_get().
But I don't. They account together for only a few percent of the
run-time, according to perf.
So I dunno. I am confused by the results, but I am not sure if I am
holding it wrong.
-Peff
next prev parent reply other threads:[~2025-08-26 3:39 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-24 8:37 [PATCH] describe: use khash in finish_depth_computation() René Scharfe
2025-08-24 10:31 ` Jeff King
2025-08-24 16:32 ` René Scharfe
2025-08-25 7:34 ` Jeff King
2025-08-25 8:13 ` Jeff King
2025-08-25 18:48 ` Junio C Hamano
2025-08-26 3:39 ` Jeff King [this message]
2025-08-26 4:26 ` Jeff King
2025-08-26 5:52 ` Jeff King
2025-08-26 15:34 ` Junio C Hamano
2025-08-31 17:25 ` René Scharfe
2025-09-01 19:06 ` René Scharfe
2025-09-02 12:38 ` Jeff King
2025-09-02 18:51 ` René Scharfe
2025-09-03 14:31 ` Jeff King
2025-09-03 15:41 ` René Scharfe
2025-09-04 11:16 ` Jeff King
2025-09-03 16:30 ` René Scharfe
2025-09-04 11:22 ` Jeff King
2025-09-02 18:24 ` [PATCH v2] describe: use oidset " René Scharfe
2025-09-03 14:36 ` Jeff King
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=20250826033920.GA388997@coredump.intra.peff.net \
--to=peff@peff$(echo .)net \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=l.s.r@web$(echo .)de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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