Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Commenting and large pipelines
In addition to what Lawrence said ...
On Tue, May 10, 2022 at 11:35 PM Zach Riggle <zachriggle@xxxxxxxxx> wrote:
>
> 3. Is the use of {} better than ()?
In most cases it won't matter. Putting something on the left side of
a pipe in zsh already starts it in a subshell, and most such subshells
are subject to an optimization such that zsh will exec the last
command to replace the shell process.
On the right side of a pipe, however commands in { } stay in the
current shell whereas those in ( ) run in a forked subshell.
> 4. How much of a performance hit does this make, versus hand-writing a different pipeline?
It's definitely going to perform better than a pipeline built by
assigning and expanding array parameters. Otherwise the performance
difference should be minimal.
> 5. Are there any ways to improve this? For example, replacing 'cat' in the default case.
You're not going to do better than "cat" in that context.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author