zsh-workers
 help / color / mirror / code / Atom feed
From: Jun T <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: ZSH performance regression in 5.8.1.2-test
Date: Wed, 27 Apr 2022 22:58:50 +0900	[thread overview]
Message-ID: <779E1EC7-7AC8-4B3D-9D9E-C0089320D163@kba.biglobe.ne.jp> (raw)
In-Reply-To: <6AEDDA47-F8ED-4160-8FFF-8D3C70B12490@kba.biglobe.ne.jp>

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@gmail.com> 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⁩)?

  parent reply	other threads:[~2022-04-27 13:59 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-25 18:16 Jordan Patterson
2022-04-25 18:56 ` Bart Schaefer
2022-04-25 19:20   ` Stephane Chazelas
2022-04-25 21:27     ` Bart Schaefer
2022-04-26  7:01       ` Bart Schaefer
2022-04-26  8:31         ` Peter Stephenson
2022-04-27  0:33           ` Bart Schaefer
2022-04-27 14:11           ` Stephane Chazelas
2022-04-27 15:02             ` Bart Schaefer
2022-04-27 15:07               ` Peter Stephenson
2022-04-27 15:17                 ` Bart Schaefer
2022-04-26 14:31         ` Jun. T
2022-04-26 15:15           ` Peter Stephenson
2022-04-27  0:55             ` Bart Schaefer
2022-04-27  9:16               ` Jun T
2022-04-27  0:38           ` Bart Schaefer
2022-04-27  9:34             ` Peter Stephenson
2022-04-27 10:28               ` Jun T
2022-04-27 12:42                 ` Jun T
2022-04-27 13:58                 ` Jun T [this message]
2022-04-27 15:25                   ` Bart Schaefer
2022-04-27 16:18                     ` Jun. T
2022-04-27 19:54         ` Jordan Patterson
2022-04-28  9:53           ` Jun T
2022-04-28 14:56             ` Bart Schaefer
2022-04-28 18:51           ` Jun. T
2022-04-29  0:28             ` Bart Schaefer
2022-04-29  2:25               ` Jun. T
2022-04-26  1:08 ` Bart Schaefer
2022-04-26  3:03   ` Jordan Patterson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=779E1EC7-7AC8-4B3D-9D9E-C0089320D163@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).