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