From: "Jan Klötzke" <jan@kloetzke.net>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
"Steve Kemp" <steve@steve.org.uk>, "René Scharfe" <l.s.r@web.de>,
"Stefan Beller" <stefanbeller@gmail.com>
Subject: Re: [PATCH] ref-filter: handle nested tags in --points-at option
Date: Mon, 3 Jul 2023 22:25:03 +0200 [thread overview]
Message-ID: <ZKMun/sl9rS/2gQC@thinkpad.fritz.box> (raw)
In-Reply-To: <20230702220243.GA1534980@coredump.intra.peff.net>
Am Sun, Jul 02, 2023 at 06:02:43PM -0400 schrieb Jeff King:
> On Sun, Jul 02, 2023 at 08:56:11AM -0400, Jeff King wrote:
>
> > My biggest question would be whether this introduces any performance
> > penalty for the more common cases (lightweight tags and single-level
> > annotated tags). The answer is "no", I think; we are already paying the
> > cost to parse every object to find out if it's a tag, and your new loop
> > only does an extra parse if we see a tag-of-tag. Good.
>
> Reading more carefully, I think this does actually change the
> performance a bit, because we end up parsing the pointed-to commits, as
> well. So here's before and after your patch running "git for-each-ref
> --points-at=HEAD" on linux.git (785 refs, all but 3 are tags):
>
> Benchmark 1: ./git.old for-each-ref --points-at=HEAD
> Time (mean ± σ): 11.4 ms ± 0.2 ms [User: 6.5 ms, System: 4.9 ms]
> Range (min … max): 11.0 ms … 12.3 ms 239 runs
>
> Benchmark 2: ./git.new for-each-ref --points-at=HEAD
> Time (mean ± σ): 20.6 ms ± 0.5 ms [User: 10.4 ms, System: 10.2 ms]
> Range (min … max): 19.8 ms … 22.7 ms 133 runs
>
> Summary
> './git.old for-each-ref --points-at=HEAD' ran
> 1.80 ± 0.06 times faster than './git.new for-each-ref --points-at=HEAD'
>
> The absolute numbers are pretty small, but the percent change isn't
> great. I'll send some patches in a minute that can be applied on top to
> improve this case, as well as fix the other issues I pointed out in the
> existing code.
I have to admit I was not entirely sure about the performance
implications. The relative performance drop is indeed substantial.
Thanks for the thorough review and swiftly taking care of these!
-- Jan
next prev parent reply other threads:[~2023-07-03 20:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-01 20:57 [PATCH] ref-filter: handle nested tags in --points-at option Jan Klötzke
2023-07-02 12:56 ` Jeff King
2023-07-02 16:25 ` René Scharfe
2023-07-02 20:27 ` Jeff King
2023-07-02 22:02 ` Jeff King
2023-07-02 22:33 ` [PATCH 0/3] a few --points-at optimizations/cleanups Jeff King
2023-07-02 22:35 ` [PATCH 1/3] ref-filter: avoid parsing tagged objects in match_points_at() Jeff King
2023-07-02 22:37 ` [PATCH 2/3] ref-filter: avoid parsing non-tags " Jeff King
2023-07-02 22:38 ` [PATCH 3/3] ref-filter: simplify return type of match_points_at Jeff King
2023-07-03 20:25 ` Jan Klötzke [this message]
2023-07-05 6:10 ` [PATCH] ref-filter: handle nested tags in --points-at option Junio C Hamano
2023-07-05 12:41 ` Jeff King
2023-07-05 17:16 ` Junio C Hamano
2023-07-05 18:50 ` Jan Klötzke
2023-07-05 20:15 ` 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=ZKMun/sl9rS/2gQC@thinkpad.fritz.box \
--to=jan@kloetzke.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=l.s.r@web.de \
--cc=peff@peff.net \
--cc=stefanbeller@gmail.com \
--cc=steve@steve.org.uk \
/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).