public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Speed up "gdb -tui" output
Date: Tue, 06 Jan 2015 20:54:00 -0000	[thread overview]
Message-ID: <CADPb22QeiSrzD81kMJeqpnDBrx1DybpbGmHc1r0koGDtqAu8tw@mail.gmail.com> (raw)
In-Reply-To: <83sifn7mpt.fsf@gnu.org>

On Tue, Jan 6, 2015 at 11:06 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Tue, 6 Jan 2015 10:37:13 -0800
>> From: Doug Evans <dje@google.com>
>> Cc: gdb-patches <gdb-patches@sourceware.org>
>>
>> bash$ gdb -tui
>> (gdb) file foo<ret>
>>
>> At this point I've hit return but I don't see anything printed.
>>
>> pause pause pause
>>
>> and then finally I see all the output:
>>
>> Reading symbols from foo...done.
>> mumble ...
>> (gdb)
>
> If this is the only place where this matters, we could break that line
> in two:
>
>   Reading symbols from foo...
>   Done reading symbols from foo.
>
> Or maybe we could also call wrefresh when we see 3 consecutive dots,
> assuming that these are the cases where a prolonged operation is under
> way.

Not adding a newline after the three dots does lead to other problems:
the code is assuming other code won't output a newline.  It may be uncommon
but it still happens. Thus one could make the case that outputting anything
like this without a newline is something to be avoided.
OTOH, I wouldn't want to preclude it.

Keying off of "..." is a possibility, we could make it a formal convention.
One could make the case that it's too hacky though, I don't have a
strong opinion.
tui_puts would have to maintain global state to track what it's been previously
sent, which one would like to avoid if possible (though I see tui_puts already
does that to handle annotations).
I don't know if there are other places in gdb that output something
(sans newline),
do some work, and then output the rest of the line (setting aside
debugging output).
They would all have to be audited and maybe changed.

>
>> 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.

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).
So one way to go, and again, this is just a possibility,
is to not send tui_puts a character at a time.

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

  reply	other threads:[~2015-01-06 20:54 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 [this message]
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

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=CADPb22QeiSrzD81kMJeqpnDBrx1DybpbGmHc1r0koGDtqAu8tw@mail.gmail.com \
    --to=dje@google.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).