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

Re: ZSH performance regression in 5.8.1.2-test



I did a few test to see the performance improvement.

mkdir tmpdir && cd tmpdir
N=400000
for ((i=0; i<N; ++i)); do
    echo '# foo bar boo foo bar boo'
done > tmp.txt
ln -s tmp.txt .zshrc

tmp.txt contains 400,000 lines of comments (and nothing else).
tmpdir/.zshrc is the symlink to tmp.txt.

Then run the following 5 test (in the tmpdir):
(1) time ZDOTDIR=. zsh -ic exit
(2) time zsh -f tmp.txt
(3) time zsh -f < tmp.txt
(4) time echo 'source tmp.txt' | zsh -f
(5) time cat tmp.txt | zsh -f

total (approximate) CPU seconds are (tested on my iMac):

                     (1)   (2)   (3)   (4)   (5)
zsh-5.8             0.9   0.8   6.6   0.8   8.2
zsh-5.8.1           0.6   0.5   0.7   0.5   0.8
zsh-5.8.1.2-test    5.7   5.5   5.7   5.5   7.3
lseek() patch       0.7   0.5   1.4   0.5   7.8
bash                ---   0.5   0.5   0.5   6.8   (bash --norc)

(2) and (4) are almost equivalent, as it should be.

With lseek() patch we get "reasonable" performance for (1)-(4).
(3) is somewhat slower, because it is reading form stdin and
need to call lseek() many times.

The column (1) in the table above shows that both 5.8.1 and
lseek() patch are about 8-10 times faster than 5.8.1.2-test.
This ratio (about 8-10), obtained with .zshrc that contains
400,000 lines of comments, is close to the ratio reported by
Jordan with his .zshrc:

> 2022/04/26 3:16, Jordan Patterson <jordanp@xxxxxxxxx> wrote:
> 
> Summary
>  'prefix/5.8.1/bin/zsh -i -c exit' ran
>    1.16 ± 0.06 times faster than 'prefix/5.8/bin/zsh -i -c exit'
>    9.22 ± 0.27 times faster than 'prefix/5.8.1.2-test/bin/zsh -i -c exit'


Jordan, what do you get by the following?
zsh -xic exit 2>>(wc)
Can you try the lseek() patch (in my previous post, 50115⁩)?



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