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

From: Stefan Monnier <[email-masked]>
Date: Sun, 11 Sep 2022 09:49:11 -0400

> +DEFUN ("tty--set-output-buffer-size", Ftty__set_output_buffer_size,
> +       Stty__set_output_buffer_size, 1, 2, 0, doc:
> +       /* Set the output buffer size for a TTY.
> +
> +SIZE zero means use the system's default value.  If SIZE is
> +non-zero,this also avoids flushing the output stream.
           ^^
           SPC

> +TTY may be a terminal object, a frame, or nil (meaning the selected
> +frame's terminal).
> +
> +This function temporarily suspends and resumes the terminal
> +device.  */)
> +  (Lisp_Object size, Lisp_Object tty)
> +{
> +  if (!TYPE_RANGED_FIXNUMP (size_t, size))
> +    error ("Invalid output buffer size");
> +  Fsuspend_tty(tty);
                ^^
                SPC

> +  struct terminal *terminal = decode_tty_terminal (tty);
> +  terminal->display_info.tty->output_buffer_size
> +    = XFIXNUM (size) <= 0 ? 0 : XFIXNUM (size);
> +  return Fresume_tty(tty);
                      ^^
                      SPC

That seems a bit over-engineered to me.
Why not just a DEVAR_BOOL to control whether we flush or not?
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).

        Stefan