Re: [PATCH] Speed up "gdb -tui" output

Eli Zaretskii
2015-01-07T18:30:31Z

> Date: Tue, 6 Jan 2015 12:54:02 -0800
> From: Doug Evans <dje@google.com>
> Cc: gdb-patches <gdb-patches@sourceware.org>
>
> >> Another possibility would be to do the string -> char -> string
> >> processing differently. String printing utilities could accumulate
> >> what they want to print and send the output in chunks instead
> >> of characters.
> >> Then tui_puts could get real strings instead of always getting
> >> { char, '\0' }, and maybe that would be enough.
> >
> > This will hit the same problem: how to know when to stop accumulating
> > and flush it out.
>
> What I'm saying is tui_puts would still call wrefresh unconditionally.
> This is no different than your patch, conceptually, except that
> it'd be up to higher layers to not send tui_puts a character at a time for the
> common case of outputting strings.

In the current implementation, tui_puts almost _always_ gets a single
character. This is because all the *_unfiltered output functions
eventually call null_write, which calls the to_fputs method one
character at a time (and has some apology to defend that).

> We send output a character at a time in part to support
> lines_per_page, chars_per_line, and wrap_column,
> relying on character-at-a-time buffering to save us.
> Alas for windows that doesn't apparently doesn't work (yay windows).

The problem is not Windows per se, it's the Windows console driver
implemented as part of ncurses.

> So one way to go, and again, this is just a possibility,
> is to not send tui_puts a character at a time.

This means a major redesign of how ui-file and friends work, much more
than the energy and time I have to spend on this issue.

> Is it possible to fix windows?
> If the bug really is there ...

It isn't.