Optimize tty display updates (bug#57727)

* src/dispnew.c (update_frame_1): Don'f flush if tty's
output_buffer_size is non-zero.
* src/sysdep.c (init_sys_modes): Setvbuf depending on the tty's
output_buffer_size.
* src/term.c (Ftty__set_output_buffer_size, Ftty__output_buffer_size):
Low-level interface for setting and retrieving a tty's output buffer
size.
(syms_of_term): Defsubr the new functions.
* src/termchar.h (struct tty_display_info): New member
output_buffer_size.
* stc/NEWS: Describe the change.
This commit is contained in:
Gerd Möllmann 2022-09-11 11:42:18 +02:00
parent 5bf8f9cc0d
commit cbac94b4ae
5 changed files with 60 additions and 2 deletions

View file

@ -1304,7 +1304,10 @@ init_sys_modes (struct tty_display_info *tty_out)
}
#endif /* F_GETOWN */
setvbuf (tty_out->output, NULL, _IOFBF, BUFSIZ);
const size_t buffer_size = (tty_out->output_buffer_size
? tty_out->output_buffer_size
: BUFSIZ);
setvbuf (tty_out->output, NULL, _IOFBF, buffer_size);
if (tty_out->terminal->set_terminal_modes_hook)
tty_out->terminal->set_terminal_modes_hook (tty_out->terminal);