Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Jonas Bernoulli <jonas@bernoul.li>, git@vger.kernel.org
Subject: Re: "submodule foreach" much slower than removed "submodule--helper --list"
Date: Mon, 17 Oct 2022 13:46:23 -0400	[thread overview]
Message-ID: <Y02U7611DH6zFsK9@coredump.intra.peff.net> (raw)
In-Reply-To: <221017.86h702jsiq.gmgdl@evledraar.gmail.com>

On Mon, Oct 17, 2022 at 06:50:06PM +0200, Ævar Arnfjörð Bjarmason wrote:

> Sorry about the slowdown, the removal of "list" was just an in-between
> step to migrating "submodule" to a full built-in.
> 
> I can't reproduce anything like the 8ms v.s. ~600ms difference you note
> here, but for me migrating it to a built-in is around 10% slower with
> "foreach" than the old "list". I wonder what results you get?

I don't think "foreach" can ever be as performant as a bare "list". It
inherently is going to do O(n) fork+execs. So it's OK if you have one or
two submodules, but not if you have hundreds.

If it treated "echo" as a builtin and served it in-process, it could
avoid that extra overhead. But there are so many corner cases there,
you'd probably do better to add "list --format" instead.

-Peff

  reply	other threads:[~2022-10-17 17:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-15 16:50 "submodule foreach" much slower than removed "submodule--helper --list" Jonas Bernoulli
2022-10-15 17:34 ` Jonas Bernoulli
2022-10-15 18:13   ` Jeff King
2022-10-15 18:16     ` Junio C Hamano
2022-10-15 18:23       ` Jeff King
2022-10-15 18:37         ` Junio C Hamano
2022-10-15 22:40     ` Junio C Hamano
2022-10-17 17:02       ` Jeff King
2022-11-07 11:01       ` Matti Möll
2022-11-08  2:50         ` Taylor Blau
2022-11-08  3:37           ` Ævar Arnfjörð Bjarmason
2022-10-17 16:50   ` Ævar Arnfjörð Bjarmason
2022-10-17 17:46     ` Jeff King [this message]
2022-10-21 14:58     ` Jonas Bernoulli

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=Y02U7611DH6zFsK9@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jonas@bernoul.li \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).