git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
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: Tue, 26 Aug 2025 08:34:00 -0700	[thread overview]
Message-ID: <xmqqwm6qksgn.fsf@gitster.g> (raw)
In-Reply-To: <20250826042607.GA995491@coredump.intra.peff.net> (Jeff King's message of "Tue, 26 Aug 2025 00:26:07 -0400")

Jeff King <peff@peff.net> writes:

> OK, maybe I am just holding it wrong. I think I may have mistakenly been
> using the wrong timing for my baseline (maybe --date-order instead of
> --author-date-order; the latter is _way_ more expensive because we have
> to open the commits to parse the author date).

True.  And the numbers below are much more believable ;-)

> Here's a more apples-to-apples comparison using hyperfine. On git.git:
> ...
> So a little slowdown, but within the run-to-run noise. And on linux.git:
> ...
> A little more measurable there. Those numbers are more in line with what
> I was expecting.
> ...
> I'm not sure what it all means, though. 6% is enough that it is
> probably worth keeping a custom data type like slab around.
> Though it would be nice to have a data type that worked on all
> object types and didn't necessarily use a ton of memory.

Yup, a short version of it is "assume that we still live in the old
world where 'you want to compute X?  spawn a process, work in-core
and compute and spew out your result, then exit(3) will clean up
after you' was the norm.  And our codebase has an easy way to tell
the object API to allocate N extra bytes for app specific per object
bookkeeping purpose.  Now, would you use that facility to store your
data there because you'd need that data for all objects you touch in
your application?" and if the answer is yes, it belongs to slab,
otherwise you are better off with a separate hashtable indexed via
object names populated only for few selected objects you care about.

For example, the slab is something I would have used to rewrite
"show-branch", since it would have been really handy to have more
bits in per-object "flags", and the most natural way to write that
application is to keep one bit in all objects it slurps in core for
every starting ref.

> This particular case may not be representative, either. I picked it
> because it was easy to convert. But I wonder how bad it would be to put
> the object flags for a traversal into a hash. Right now those are in the
> original struct, not even in a commit-slab. So I'd guess it's an even
> bigger slowdown.

True, too.

  parent reply	other threads:[~2025-08-26 15:34 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
2025-08-26  4:26             ` Jeff King
2025-08-26  5:52               ` Jeff King
2025-08-26 15:34               ` Junio C Hamano [this message]
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=xmqqwm6qksgn.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    --cc=peff@peff.net \
    /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;
as well as URLs for NNTP newsgroup(s).