Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: slow startup of zsh (1x slower than bash)
- X-seq: zsh-users 24199
- From: Peng Yu <pengyu.ut@xxxxxxxxx>
- To: julien.nicoulaud@xxxxxxxxx
- Subject: Re: slow startup of zsh (1x slower than bash)
- Date: Wed, 4 Sep 2019 05:13:44 -0500
- Cc: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>, zsh-users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hkN2B+Z5VEmRuuH4EvQazTJvJsgBN6ar3SjAWhBsjQE=; b=qrszAC8hBF2l3X4/zuIGJxzUS/6MQrhHbhhqxYesx4EdYkbSCqRORUu0sipnVpwMoq XMgbkRBsd28vEIXiJ1nqTN1nTfB0rt/w8+F9WL6ikGpbgBTP4/XKzeEt0I5zSrWWNDR5 v8Jq5CKMlPJcZf5NlhaOIsEKbTs4N1B4+X/BS22YnfQBrYV4S9FyKdC4vib8sIfpU34+ 5xEQli2xWfMcOFd7X9WUmNv1YPMWAuoaznMsSZzyKChWJsMqIl6D2TV5VR/fVmCFaykQ Wi/p8IVu3BNTnrFF2muQ4+CdCp4h5WgXnGc+FQYwqX28DfYGgwLLClxXl0ilktv8hTph 7NnQ==
- In-reply-to: <CABrM6wkGd4=ikqoZOreovU95MpPe1fparZ+5qse-8fZ4M=3-OQ@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CABrM6wk-psFFZcZW+M7OwD0ZwrMbNk4MN7e9aaJF9kBOFsVK4w@mail.gmail.com> <CAKc7PVDGmfMxkUzjmyFxJY7fNhHV16Z3xhQpNXnjEwAMf6G9hQ@mail.gmail.com> <CABrM6w=B8BP6Pk4HsW+XGDv0bpC9fYtNdr80SS6BtqegXJNcUA@mail.gmail.com> <CA+mcLN5dpscPNhpsKoA0j8tvcUh2-A7KOX7wNQYFQ7q3sdg+SA@mail.gmail.com> <CABrM6wkGd4=ikqoZOreovU95MpPe1fparZ+5qse-8fZ4M=3-OQ@mail.gmail.com>
Are there any consensus on how fast is zsh starting time compared with
other shells? My test was on Mac via homebrew.
On Fri, Dec 7, 2018 at 10:58 AM Peng Yu <pengyu.ut@xxxxxxxxx> wrote:
> Not on my machine.
>
> $ ./main.sh
> time ./script.bash
>
> real 0m0.719s
> user 0m0.264s
> sys 0m0.324s
> time ./script.zsh
>
> real 0m1.295s
> user 0m0.360s
> sys 0m0.680s
>
> ==> main.sh <==
> #!/usr/bin/env bash
> # vim: set noexpandtab tabstop=2:
>
> set -v
> time ./script.bash
> time ./script.zsh
>
> ==> script.bash <==
> #!/usr/bin/env zsh
> # vim: set noexpandtab tabstop=2:
>
> time for ((i=0;i<100;++i))
> do
> /usr/local/bin/bash --norc --noprofile -c exit
> done
>
> ==> script.zsh <==
> #!/usr/bin/env zsh
> # vim: set noexpandtab tabstop=2:
>
> time for ((i=0;i<100;++i))
> do
> /usr/local/bin/zsh -fc exit
> done
>
>
> On Fri, Dec 7, 2018 at 10:14 AM Julien Nicoulaud
> <julien.nicoulaud@xxxxxxxxx> wrote:
> >
> > I don't think so, zsh is faster than bash for me without rc files:
> >
> > ❯ repeat 5 { time bash --norc --noprofile -c exit }
> > took 0,011s (100% cpu)
> > took 0,011s (98% cpu)
> > took 0,011s (100% cpu)
> > took 0,011s (100% cpu)
> > took 0,011s (99% cpu)
> > ❯ repeat 5 { time zsh -fc exit }
> > took 0,002s (89% cpu)
> > took 0,001s (90% cpu)
> > took 0,001s (92% cpu)
> > took 0,001s (92% cpu)
> > took 0,001s (91% cpu)
> >
> > same with rc files:
> > ❯ repeat 5 { time bash -c exit }
> > took 0,028s (89% cpu)
> > took 0,022s (100% cpu)
> > took 0,022s (100% cpu)
> > took 0,022s (100% cpu)
> > took 0,023s (99% cpu)
> > ❯ repeat 5 { time zsh -c exit }
> > took 0,008s (91% cpu)
> > took 0,008s (92% cpu)
> > took 0,007s (92% cpu)
> > took 0,007s (92% cpu)
> > took 0,005s (91% cpu)
> >
> > Julien
> >
> > Le ven. 7 déc. 2018 à 03:57, Peng Yu <pengyu.ut@xxxxxxxxx> a écrit :
> >>
> >> On Thu, Dec 6, 2018 at 8:20 PM Sebastian Gniazdowski
> >> <sgniazdowski@xxxxxxxxx> wrote:
> >> >
> >> > On Mon, 3 Dec 2018 at 17:28, Peng Yu <pengyu.ut@xxxxxxxxx> wrote:
> >> > >
> >> > > Hi,
> >> > >
> >> > > The following example shows that zsh startup time is much slower
> than
> >> > > other shells. Can this be improved to at least as fast as bash?
> >> > >
> >> >
> >> > Is it the last zsh version that's being tested? There was 2x startup
> >> > improvement at 5.4 or something like this.
> >>
> >> Here is the version. I have not set up zsh to do anything fancy. I
> >> guess the slowness of startup is because zsh does too many things
> >> upfront and has more features than other shells, and the increase in
> >> startup time the price that zsh has to pay.
> >>
> >> $ zsh --version
> >> zsh 5.6.2 (x86_64-apple-darwin17.7.0)
> >> $ cat ~/.zshrc
> >> # Lines configured by zsh-newuser-install
> >> HISTFILE=~/.histfile
> >> HISTSIZE=1000
> >> SAVEHIST=1000
> >> bindkey -e
> >> # End of lines configured by zsh-newuser-install
> >> # The following lines were added by compinstall
> >> zstyle :compinstall filename '/Users/pengy/.zshrc'
> >>
> >> autoload -Uz compinit
> >> compinit
> >> # End of lines added by compinstall
> >>
> >> > Also, Zplugin can load plugins after prompt, I load 20 plugins, and my
> >> > startup times are:
> >> >
> >> > repeat 5 { time /usr/local/bin/zsh-5.6.2-dev-1 -i -c exit }
> >> > /usr/local/bin/zsh-5.6.2-dev-1 -i -c exit 0,09s user 0,04s system
> >> > 117% cpu 0,111 total
> >> > /usr/local/bin/zsh-5.6.2-dev-1 -i -c exit 0,10s user 0,05s system
> >> > 119% cpu 0,130 total
> >> > /usr/local/bin/zsh-5.6.2-dev-1 -i -c exit 0,11s user 0,05s system
> >> > 121% cpu 0,129 total
> >> > /usr/local/bin/zsh-5.6.2-dev-1 -i -c exit 0,09s user 0,04s system
> >> > 115% cpu 0,119 total
> >> > /usr/local/bin/zsh-5.6.2-dev-1 -i -c exit 0,09s user 0,04s system
> >> > 117% cpu 0,109 total
> >> >
> >> > I even load prompt after a default prompt, ~ 100 ms after it. The
> >> > Star-Trek console-like impression this gives can be visible here:
> >> > https://asciinema.org/a/156726 – much is going on, automatically, in
> >> > background.
> >> >
> >> > > --
> >> > > Regards,
> >> > > Peng
> >> >
> >> > --
> >> > Sebastian Gniazdowski
> >> > News: https://twitter.com/ZdharmaI
> >> > IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
> >> > Blog: http://zdharma.org
> >>
> >>
> >>
> >> --
> >> Regards,
> >> Peng
>
>
>
> --
> Regards,
> Peng
>
--
Regards,
Peng
Messages sorted by:
Reverse Date,
Date,
Thread,
Author