zsh-users
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Shell startup, aliases vs. functions vs. autoloadable functions, and zcompile benefits
Date: Tue, 30 Nov 2021 09:27:19 +0100	[thread overview]
Message-ID: <CAHYJk3RzKT1_WoyKf4FAZ=ffQ7bbiTzSgMP=3ZPbFPWMD2QpiA@mail.gmail.com> (raw)
In-Reply-To: <CAHYJk3TJFRKD3DjmR895BFKrJB649j6W=_u8_9fBY2ptprF2tQ@mail.gmail.com>

On 11/30/21, Mikael Magnusson <mikachu@gmail.com> wrote:
> On 11/30/21, Roman Perepelitsa <roman.perepelitsa@gmail.com> wrote:
>> On Tue, Nov 30, 2021 at 3:30 AM Zach Riggle <zachriggle@gmail.com> wrote:
>>>
>>> The benchmark I used
>>>
>>> $ hyperfine 'zsh -i -l "exit 0"'
>>>
>>>
>>> Obviously this is not the BEST benchmark [for checking shell startup
>>> time]
>>
>> Obviously. It's the worst or at least a strong contender for the title.
>
> I think it's fine to do this (assuming he actually meant -i -l -c
> "exit 0" (missing -c in the quoted command)), if you don't do any
> weird stuff in your startup files (like you mention in your "how not
> to benchmark" section). Assuming your startup files are synchronous,
> the above will tell you how long it takes to execute your init file
> plus some other overhead, so if you do something and the number is
> lower, the thing you did will indeed make startup faster. If your
> startup files are not synchronous, then obviously nothing I said
> applies and everything you say is true. BTW, the above command can
> easily be improved for worseness:
> % time (repeat 1000; zsh -ic exit)
>
>> Since you care about interactive zsh performance, at least skim
>> through the homepage of zsh-bench. It'll save you time.
>
> % ./zsh-bench
> ==> benchmarking login shell of mikaelh ...
> zsh-bench: cannot find prompt; make sure it contains hostname or the
> last part of the current directory
>
> Sadly no time was saved :(.

Got it running by changing prompt_pat to %,
first_command_lag_ms=48.233
first_prompt_lag_ms=33.816
exit_time_ms=32.177

I'd say these values are fairly comparable :).

It would be very useful to have an option to benchmark normal
interactive shells instead of login shells btw, my profile runs stuff
like fortune which is obviously pretty slow in comparison to startup
code, and not at all interesting to benchmark. The  quoted times in
this mail is with all the -l removed.

Also, you recommend against zcompiling .zshrc in your document, but
first_command_lag_ms=56.709
first_prompt_lag_ms=42.367
exit_time_ms=40.885

Increasing startup time by 33% seems like a bad tradeoff to me, then
again, I know exactly how things work and am not likely to make the
mistake you mention.

-- 
Mikael Magnusson


  reply	other threads:[~2021-11-30  8:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-27  8:10 Zach Riggle
2021-11-27  8:33 ` Roman Perepelitsa
2021-11-27 20:22   ` Bart Schaefer
2021-11-30  2:30     ` Zach Riggle
2021-11-30  4:11       ` Bart Schaefer
2021-11-30  8:18         ` Zach Riggle
2021-11-30  7:51       ` Roman Perepelitsa
2021-11-30  8:10         ` Mikael Magnusson
2021-11-30  8:27           ` Mikael Magnusson [this message]
2021-11-30  8:30             ` Zach Riggle
2021-11-30  9:11             ` Roman Perepelitsa
2021-11-30 11:49               ` Zach Riggle
2021-11-30 12:30                 ` Roman Perepelitsa
2021-11-30 15:10                   ` Zach Riggle
2021-11-30 16:37                     ` Bart Schaefer
2021-11-30 16:41                       ` Roman Perepelitsa
2021-11-30  8:29           ` Roman Perepelitsa
2021-11-30  8:25         ` Zach Riggle

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='CAHYJk3RzKT1_WoyKf4FAZ=ffQ7bbiTzSgMP=3ZPbFPWMD2QpiA@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=roman.perepelitsa@gmail.com \
    --cc=zsh-users@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).