Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Pedro Alves <palves@redhat.com>,
	gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Speed up "gdb -tui" output
Date: Wed, 07 Jan 2015 18:56:00 -0000	[thread overview]
Message-ID: <CADPb22Tbf7kfTjBn1Ur4r1sY4sEeNrTGhid8yZWut0gvAihcBw@mail.gmail.com> (raw)
In-Reply-To: <83k30y78ol.fsf@gnu.org>

On Wed, Jan 7, 2015 at 10:22 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Wed, 7 Jan 2015 10:00:32 -0800
>> From: Doug Evans <dje@google.com>
>> Cc: Eli Zaretskii <eliz@gnu.org>, gdb-patches <gdb-patches@sourceware.org>
>>
>> >  -  /* We could defer the following.  */
>> >  -  wrefresh (w);
>> >  -  fflush (stdout);
>> >  +   if (c == '\n')
>> >  +    gdb_flush (gdb_stdout);
>> >
>> > would it work?
>>
>> TBH I'm not entirely sure why the fflush (stdout) is there.
>
> Obviously, Someone(TM) relied on the fact that on Unix curses writes
> to stdout.  There are many such places in the code, not only in TUI.

Except that (and I'm relying on memory here so heads up),
curses programs don't need or do fflush (stdout).  Even Unix ones.

>> So, yeah, it seems like gdb_flush for tui needs to do a wrefresh
>> (for gdb_stdout/stderr (/stdlog?))
>
> At least, see my other message.  And it should treat them differently,
> since their buffering is different, and the rest of GDB relies on that
> a lot.  And tui_puts currently doesn't know which stream it serves.

It's easy enough to make tui_puts know what stream it's serving though,
so I'm not worried about that.

>> Normally in curses line buffering doesn't make any sense.
>
> ??? The whole point of this discussion is to introduce some kind of
> buffering to avoid terribly slow performance in TUI mode.

Yes, I know.

For reference sake, by "line buffering" I'm referring to stdio
line buffering.  Curses is different.  It handles buffering differently.
One writes to various windows/frames/whatever (I can't remember
this part of curses terminology), that can be anywhere on the screen,
or even write directly to specific rows/columns,
and then when one does a refresh curses optimizes the "transmission"
of characters to the #rows-by-#columns grid of characters that the
user sees.  There is no "line" as far as the physical connection
to the screen goes.  Way back when, ttys and 1200 baud connections
made this optimization important. :-)

>
>> One paints the window and then does a refresh.
>
> Except that for the command window, there's no such thing as "paint
> the window", AFAICS.

By "paint the window" I mean writing something into that part of the
screen.

> Various parts of GDB write out various text
> strings whenever they feel like.  You don't have a single point where
> you can tell the window is done.  Currently, we simply refresh every
> character.  My original suggestion to use a newline as such a point
> was an attempt to find an easy solution, and we already know why that
> is not good enough.

There's no "single" point, but OTOH there aren't many points either.

>> We want to add scrolling of the command line window on
>> top of that, but if the intent is for that to be handled by
>> gdb's standard set height mechanism (which could use
>> some TLC w.r.t. TUI), then the screen will be refreshed
>> at the "Type <return> to continue, ..." prompt.
>
> Yes, of course.  And this is part of the problem that needs to be
> solved.

Except that scrolling isn't straightforward in curses land.
Do we "scroll" unfiltered output (that hasn't gone through
the paginator) ?

>> I don't off hand know if TUI tries to give the user the
>> impression of scrolling if the user sets the height
>> to be larger than the physical command line window.
>
> It doesn't.  Stuff just scrolls off the screen and is lost forever.

Yeah, so we need a scroll buffer for TUI if we want
to solve that.

>> And therefore, I think we don't need to do any call to
>> gdb_flush here.  Could be missing something though.
>
> Where's "there"?

tui_puts, at least in its current implementation.
It's just an implementation detail though, so
depending on how we fix things that can change.


  reply	other threads:[~2015-01-07 18:56 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-06 16:12 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 [this message]
2015-01-07 19:11           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADPb22Tbf7kfTjBn1Ur4r1sY4sEeNrTGhid8yZWut0gvAihcBw@mail.gmail.com \
    --to=dje@google.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox