From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28261 invoked by alias); 6 Jan 2015 16:12:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 28248 invoked by uid 89); 6 Jan 2015 16:12:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mtaout26.012.net.il Received: from mtaout26.012.net.il (HELO mtaout26.012.net.il) (80.179.55.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Jan 2015 16:12:34 +0000 Received: from conversion-daemon.mtaout26.012.net.il by mtaout26.012.net.il (HyperSendmail v2007.08) id <0NHR00J00JMYZ900@mtaout26.012.net.il> for gdb-patches@sourceware.org; Tue, 06 Jan 2015 18:12:07 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout26.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NHR00GOKJO7OW30@mtaout26.012.net.il> for gdb-patches@sourceware.org; Tue, 06 Jan 2015 18:12:07 +0200 (IST) Date: Tue, 06 Jan 2015 16:12:00 -0000 From: Eli Zaretskii Subject: [PATCH] Speed up "gdb -tui" output To: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83zj9v7urq.fsf@gnu.org> X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg00079.txt.bz2 In the TUI mode, we call wrefresh after outputting every single character. Since fputs_* functions go through fputc_*, i.e. break their writes into single characters as well, and tui_putc makes a 1-character string out of every character and passes it to tui_puts, every time GDB wants to display more than a few characters, the I/O becomes very slow. I guess TUI relies on the curses library or the underlying stdio to do the buffering, but the Windows build of ncurses doesn't buffer and doesn't use stdio. The simple patch below speeds up GDB output in TUI mode several orders of magnitude, especially on Windows XP (but there's a very prominent speedup on Windows 7 as well). Any objections (ChangeLog entry will be added, of course)? *** gdb/tui/tui-io.c~1 2015-01-03 11:12:52.187500000 +0200 --- gdb/tui/tui-io.c 2015-01-06 17:59:55.098500000 +0200 *************** tui_puts (const char *string) *** 201,209 **** TUI_CMD_WIN->detail.command_info.start_line = TUI_CMD_WIN->detail.command_info.cur_line; ! /* We could defer the following. */ ! wrefresh (w); ! fflush (stdout); } /* Readline callback. --- 201,211 ---- TUI_CMD_WIN->detail.command_info.start_line = TUI_CMD_WIN->detail.command_info.cur_line; ! if (c == '\n') ! { ! wrefresh (w); ! fflush (stdout); ! } } /* Readline callback.