From c18cb04230a59edd087197d3a26e79c37909ac54 Mon Sep 17 00:00:00 2001 From: Rico Tiongson Date: Tue, 12 Feb 2019 22:29:13 +0800 Subject: [PATCH] Improve buffering performance --- comfortable-swipe.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/comfortable-swipe.cpp b/comfortable-swipe.cpp index a880311..c49baf0 100644 --- a/comfortable-swipe.cpp +++ b/comfortable-swipe.cpp @@ -16,6 +16,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include // std::ios +#include // std::cin, std::cout, std::cerr #include // std::string #include "lib/comfortable_swipe" @@ -23,6 +25,12 @@ along with this program. If not, see . int main(int argc, char** args) { + // improve buffering by decoupling loggers from stdio + std::ios::sync_with_stdio(false); + std::cin.tie(0); + std::cout.tie(0); + std::cerr.tie(0); + if (argc > 1) { std::string arg = args[1];