From 5f131878a9bf5cc13f5a7da7a367827042637768 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 5 Dec 2020 17:26:37 -0800 Subject: [PATCH] Buffer in outputter_t::term_puts We were calling write() once for each character; buffer these instead. --- src/output.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/output.cpp b/src/output.cpp index 29e43f2e3..5eb76c199 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -362,9 +362,12 @@ int outputter_t::term_puts(const char *str, int affcnt) { // scoped_push will restore it. scoped_lock locker{s_tputs_receiver_lock}; scoped_push push(&s_tputs_receiver, this); + s_tputs_receiver->begin_buffering(); // On some systems, tputs takes a char*, on others a const char*. // Like tparm, we just cast it to unconst, that should work everywhere. - return tputs(const_cast(str), affcnt, tputs_writer); + int res = tputs(const_cast(str), affcnt, tputs_writer); + s_tputs_receiver->end_buffering(); + return res; } /// Write a wide character to the outputter. This should only be used when writing characters from