public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Speed up "gdb -tui" output
@ 2015-01-06 16:12 Eli Zaretskii
  2015-01-06 18:37 ` Doug Evans
  0 siblings, 1 reply; 34+ messages in thread
From: Eli Zaretskii @ 2015-01-06 16:12 UTC (permalink / raw)
  To: gdb-patches

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.

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2015-02-04 15:39 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-06 16:12 [PATCH] Speed up "gdb -tui" output Eli Zaretskii
2015-01-06 18:37 ` Doug Evans
2015-01-06 19:06   ` Eli Zaretskii
2015-01-06 20:54     ` Doug Evans
2015-01-07 18:30       ` Eli Zaretskii
2015-01-07 19:08         ` Doug Evans
2015-01-07 19:20           ` Eli Zaretskii
2015-01-07 19:30             ` Doug Evans
2015-01-07 19:48               ` Eli Zaretskii
2015-01-07 20:45                 ` Doug Evans
2015-01-07 21:59                   ` Doug Evans
2015-01-19 17:55                     ` Eli Zaretskii
2015-01-19 18:32                       ` Doug Evans
2015-01-31 21:37                         ` Eli Zaretskii
2015-02-03 17:52                           ` Pedro Alves
2015-02-03 18:47                             ` Eli Zaretskii
2015-02-04 11:55                             ` Pedro Alves
2015-02-04 12:27                               ` Pedro Alves
2015-02-04 15:39                                 ` Eli Zaretskii
2015-02-04 15:38                               ` Eli Zaretskii
2015-01-07 15:18   ` Pedro Alves
2015-01-07 17:57     ` Eli Zaretskii
2015-01-07 18:09       ` Doug Evans
2015-01-07 18:34         ` Eli Zaretskii
2015-01-07 19:16           ` Doug Evans
2015-01-07 19:32             ` Eli Zaretskii
2015-01-07 22:30               ` Pedro Alves
2015-01-19 17:52                 ` Eli Zaretskii
2015-01-07 18:00     ` Doug Evans
2015-01-07 18:12       ` Doug Evans
2015-01-07 18:34         ` Eli Zaretskii
2015-01-07 18:21       ` Eli Zaretskii
2015-01-07 18:56         ` Doug Evans
2015-01-07 19:11           ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).