Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] compinit forks less



On Thu, Apr 30, 2026 at 10:46 AM Charles Blake <charlechaud@xxxxxxxxx> wrote:
>
> Yeah.  I didn't really work through all the complexity of an
> array-based solution, but you make good points toward the
> "this patch is simplest" idea.  In any event, it can also be
> just a step in the right direction.
>
> I started with `strace` as well, but at least on Linux with
> sequentially increasing PIDs you can do this to count forks:
>     a=($(zsh -c 'echo $$; zsh -lic echo\ \$\$; :'))
>     echo $((a[2] - a[1]))
> and many other ways like `grep processes /proc/stat` (with
> various assumptions about system activity across the polls).
> `strace` is most precise, of course.
>
> I've been using this patch without issue since around October,
> but since release talk is gearing up, I thought I should post
> it.  Only about a 5..10% performance effect for me, but some
> systems might fork much more slowly.  (Cygwin used to be like
> that, for example.)

It's worth pointing out that this <<< ${ foo } method does create a
temporary file for the redirect instead, the data doesn't just
magically appear on stdin. But that's presumably fine.

-- 
Mikael Magnusson




Messages sorted by: Reverse Date, Date, Thread, Author