Re: [PATCH 1/6] templates: Fewer subprocesses in pre-commit hook
- From
Jeff King <peff@peff.net>
- Date
- Jun 10, 2013, 21:25 UTC
- Message-ID
- <20130610212502.GE13333@sigill.intra.peff.net>
- In-Reply-To
- <1370889365-6239-2-git-send-email-richih.mailinglist@gmail.com>
On Mon, Jun 10, 2013 at 08:36:00PM +0200, Richard Hartmann wrote:
> Spawning a new subprocess for every line printed is inefficient. > Thus spawn only one instance of `echo`.
Most modern shells have "echo" as a built-in these days, and do not fork at all to run it. E.g., try "strace sh -c 'echo foo'" with your shell of choice; neither dash nor bash will fork at all.
IMHO the indentation issues make the end result of your patch less readable (and here-doc with cat is more readable, but actually _increases_ the number of processes, since cat is not usually a built-in). So I'd be in favor of keeping it as-is.
-Peff