Subject: Re: bug#57727: 29.0.50; Optimize tty display updates

From: Gerd Möllmann <[email-masked]>
Date: Tue, 13 Sep 2022 07:53:47 +0200

Stefan Monnier <[email-masked]> writes:

>> 1. Multi-tty make me feel it's natural to make the behavior terminal
>> dependent.  At least I don't consider unreasonable for a user to expect
>> being able to tailor the behavior depending on the terminal.
>
> I guess the reason why I think it's over-engineered is that I feel it's
> not something which end-users will want to play with or configure
> per-terminal: we should have a setting that works well everywhere.

I really good default would indeed be a Good Thing.  But, on the other
hand, I think it's not likely that we find something that works for
everyone all the time.

> The config vars are only needed to help find that universal setting.
>
> My guess is that the exact setting won't matter very much anyway as long
> as it's big enough to cover most redisplays (since we `fflush` anyway at
> the end of `update_frame`).
>
> For that same reason, I expect that using the OS's default will be
> good enough and it will be difficult to come up with good ways for users
> to test other values and report meaningful information about the
> impact.

As far as the OS default goes (1024 on my system), I don't think I agree
completely.  A frame on a full-size terminal window has a width of
ca. 380 columns, which is a bit much for a buffer of 1024.

I fully agree that finding a good default value is hard in every
respect, though.  But I actually count that as an argument in favor of
making it an option.

>> 4. From the recent discussion of supporting images on ttys I take away
>> that using a large buffer might help with that because of more data
>> being sent to the terminal.
>
> Could be.  Tho I suspect we'd usually want to send a file name rather
> a file's data, but in any case, this is still hypothetical, so I see no
> need to cross this bridge yet.

Agreed.

>>> If someone wants to try out different buffer sizes, I suspect that
>>> recompiling is a good enough solution (or provide a DEFVAR_INT for that
>>> and let the tester(s) call `suspend/resume-tty` by hand).
>> I didn't do that because of multi-tty.  But letting users suspend/resume
>> manually is of course an option.
>
> To the extent that I see it as a "debugging" functionality, it seems
> sufficient (another option is to tell people to use an Emacs daemon so
> they can set the var before opening the tty).

Ok, we disagree here.

How can we proceed?  What do the maintainers think?  I could also just
put in on a branch, for later.