git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: "submodule foreach" much slower than removed "submodule--helper --list"

From
Jeff King <peff@peff.net>
Date
Oct 17, 2022, 17:46 UTC
Message-ID
<Y02U7611DH6zFsK9@coredump.intra.peff.net>
In-Reply-To
<221017.86h702jsiq.gmgdl@evledraar.gmail.com>
On Mon, Oct 17, 2022 at 06:50:06PM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 6 quoted lines
> 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
Previous: Ævar Arnfjörð BjarmasonNext: Jonas Bernoulli
Message 13 of 14 in “"submodule foreach" much slower than removed "submodule--helper --list"”
  1. Jonas BernoulliOct 15, 2022
  2. Jonas BernoulliOct 15, 2022
  3. Jeff KingOct 15, 2022
  4. Junio C HamanoOct 15, 2022
  5. Jeff KingOct 15, 2022
  6. Junio C HamanoOct 15, 2022
  7. Junio C HamanoOct 15, 2022
  8. Jeff KingOct 17, 2022
  9. Matti MöllNov 7, 2022
  10. Taylor BlauNov 8, 2022
  11. Ævar Arnfjörð BjarmasonNov 8, 2022
  12. Ævar Arnfjörð BjarmasonOct 17, 2022
  13. Jeff KingOct 17, 2022
  14. Jonas BernoulliOct 21, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.