Re: [PATCH] compinit forks less
Mikael Magnusson <[email protected]>
| Newsgroups | gmane.comp.shells.zsh.devel |
|---|---|
| Message-ID | <CAHYJk3SroUZV=BK-aH0qihYNNEUR_uhnK3ZM4_nV=zgMm+C9Aw@mail.gmail.com> |
On Thu, Apr 30, 2026 at 10:46 AM Charles Blake <[email protected]> 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