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

Re: PATCH: query terminal properties on ZLE startup



On Wed, Feb 26, 2025 at 12:46 AM Oliver Kiddle <opk@xxxxxxx> wrote:
>
> Bart Schaefer wrote:
> > I'd like to see Roman's startup time stats run again with this in
> > place.  If querying the terminal significantly delays the printing of
> > the first prompt, I'd think this should at least be something that can
> > be setopt'd off and explicitly invoked later.
>
> I'm not sure what Roman's startup time stats did precisely but it is
> tiny in comparison to the sorts of times you get for starting completion
> or any of the more substantial plugins.

I believe Bard is referring to https://github.com/romkatv/zsh-bench,
which, among other things, measures:

- First prompt lag (ms): The time from the start of the shell to
  when the prompt appears on the screen.

However, zsh-bench isn't necessary for this particular case. A simple
benchmark like the following would suffice:

  time ( repeat 1000 zsh -fc 'zmodload zsh/zle' )

> Over the serial line 0.2s was about the minimum to be
> guaranteed of completion.

In my own zsh startup files, I query the terminal and use a much
higher timeout of 5s for this. When the timeout triggers, the
experience is terrible: the shell ends up misconfigured (naturally,
as the initialization depends on the reply), and zle receives junk
input unpredictably when the terminal finally responds. I've run
into this issue a couple of times when connecting over SSH to
machines with extreme packet loss.

I'd prefer if there were no timeout at all, requiring manual
interruption with Ctrl-C instead, like other initialization steps and
hooks. Would that be feasible in your implementation?

Roman




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