From: Jeff King <peff@peff.net>
To: "René Scharfe" <l.s.r@web.de>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH v2 2/2] parseopt: check for duplicate long names and numerical options
Date: Mon, 2 Mar 2026 13:24:02 -0500 [thread overview]
Message-ID: <20260302182402.GH28275@coredump.intra.peff.net> (raw)
In-Reply-To: <7c221132-c2ac-4c6f-9d89-72677a74beb5@web.de>
On Sat, Feb 28, 2026 at 12:28:39PM +0100, René Scharfe wrote:
> > Your other email made me wonder how the sorted-array solution might
> > perform (patch below). It shaves off 2ms of those 10. Probably not worth
> > caring about for "-h" output (which is already spending another 5-10ms
> > to generate the output, versus a normal parse).
> Curious; sorting performs worse on my machine (Apple M1, 1 is 2cc719175,
> 2 is patch 2 v2, 3 is your patch on top):
Interesting. Different architectures, I guess (mine's an i9). It makes
me feel better about not trying to micro-optimize the last couple
nanoseconds, though. ;)
> Benchmark 1: ./git_main rev-parse --parseopt -- -h <input
> Time (mean ± σ): 77.5 ms ± 0.4 ms [User: 73.1 ms, System: 3.5 ms]
> Range (min … max): 76.8 ms … 78.5 ms 37 runs
>
> Warning: Ignoring non-zero exit code.
>
> Benchmark 2: ./git_strset rev-parse --parseopt -- -h <input
> Time (mean ± σ): 82.6 ms ± 0.3 ms [User: 77.7 ms, System: 3.9 ms]
> Range (min … max): 82.1 ms … 83.7 ms 34 runs
>
> Warning: Ignoring non-zero exit code.
Interesting that your absolute times are much higher than mine (by a
factor of 4), but the absolute cost of the strset addition is smaller.
I'm not sure if that's another architecture difference, or maybe just
the other unrelated parts of the process startup are more expensive on
macOS (syscalls, filesystem access, etc).
Anyway, now that it is only used for "-h" I don't think we need to care
that much.
-Peff
next prev parent reply other threads:[~2026-03-02 18:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 0:13 [Bug] duplicated long-form options go unnoticed Junio C Hamano
2026-02-27 19:27 ` [PATCH 1/2] pack-objects: remove duplicate --stdin-packs definition René Scharfe
2026-02-27 19:27 ` [PATCH 2/2] parseopt: check for duplicate long names and numerical options René Scharfe
2026-02-27 22:50 ` Jeff King
2026-02-27 23:08 ` Jeff King
2026-02-27 23:28 ` Junio C Hamano
2026-02-28 9:19 ` René Scharfe
2026-02-28 9:19 ` [PATCH v2 " René Scharfe
2026-02-28 10:58 ` Jeff King
2026-02-28 11:28 ` René Scharfe
2026-03-02 18:24 ` Jeff King [this message]
2026-03-01 14:33 ` 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=20260302182402.GH28275@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=l.s.r@web.de \
/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