Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Berlin <dan@cgsoftware.com>
To: Jason Molenda <jason-swarelist@molenda.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] bug in symtab.c:lookup_block_symbol()'s search method
Date: Sat, 15 Sep 2001 13:33:00 -0000	[thread overview]
Message-ID: <C854422C-AA18-11D5-94ED-0030657B5340@cgsoftware.com> (raw)
In-Reply-To: <20010915130802.A12003@shell17.ba.best.com>

On Saturday, September 15, 2001, at 04:08 PM, Jason Molenda wrote:

> On Sat, Sep 15, 2001 at 10:54:06AM -0400, Daniel Berlin wrote:
>
>> Note that combining the solutions I later attempted avoids the problem
>> of having
>> to show that all the languages gdb supports can't do symbol lookups
>> on something that starts with a character strcmp_iw ignores,
>> altogether.
>
> I guess you didn't read either of my initial notes in this discusssion.
> I provided pointers to them in the patch submission.
Actually, I did.
You are talking about a hack i had added to avoid repeated lookups, not 
the later attempts to make lookup_block_symbol faster.

>
>> This would be using a hash table for the block array, which we already
>> have a hash function ideal for (minsym_hash_iw or whatever it's
>> called), and the not actually searching blocks that don't contain the
>> symbol.
>>
>> This would give you O(1) symbol lookup time, effectively (A given
>> symbol only searches a constant number of blocks).
>> This would certainly make your debugger much faster to respond.
>
>
> What you're proposing is to ignore the inefficiencies of
> lookup_block_symbol by reducing the number of calls to it.
No, I'm not.
Please *read* what i am proposing.


>   Instead,
> why don't we fix the inefficiencies in lookup_block_symbol *and*
> reduce the number of calls to it?
Which is exactly what i propose doing, and in fact, *have done before*.
You are simply going by what appears on gdb-patches years ago, as 
submitted patches.


>   Imagine how the gdb users will
> be dancing in the street, thanking buddha for their great fortune of
> having such a wonderful debugger.
>
> Concretely.  GDB has a number of symtabs, call it 'i', and a number of
> _unique_ global blocks, call it 'j'.  Every symtab has a link to a 
> global
> block, but few of these global blocks are unique.  In gdb itself, i is
> an order of magnitude larger than j.  I expect some programs will have
> i two orders of magnitude larger than j.  Each global block has a number
> of symbols in it, call the average of these 'n'.
>
> In gdb 5.0, looking for an undefined symbol will happen on order of
> O(i * lg (n)).  In gdb 5.1, that search will be on the order of
> O(i * 1/2 * n).  Dan's proposal is to change this to O(j * 1/2 * n).
> I am looking for at _least_ O(i * lg (n)), but I'd really like to see
> us get both of these eventually for O(j * lg (n)).
No, my proposal is not going to make it O(j * 1/2 * n).
It's going to make it O(j) with the patch i sent you a few hours ago, 
and O(log  j) if you combined it with an approach to not look in blocks 
unless the symbol is in there (which can be done in O(1) time.
> If we define conservatively as i = j * 10, these become
>
>  gdb 5.0                   O (j * 10 * lg (n))
>  gdb 5.1                   O (j * 10 * 1/2 * n)
>  My patch                  O (j * 10 * lg (n))
>
>  What I'd like to see      O (j * lg (n))
>  Dan's block patch alone   O (j * 1/2 * n))
No, actually, it would be O(j).
Each block lookup takes O(1) time, if the block is a hash table.
If you had to search every globally unique block, you'd search j blocks, 
at O(1) time, for a total of O (j).

Combining the patch I sent you a few hours ago, with a patch to not even 
search blocks where the symbol won't be in, makes it O(log j).


Please stop assuming the patch i have sent you is something i had 
submitted already.
It is not, AFAIK.
It was talked about, if you look at the archives.

I have *been down this road before*.
I have *sped up gdb symbol lookups to the point they take effectively 
constant time (O (number of active scopes))*.
The patches to do this are *not* on gdb-patches.

>
> Debugging gdb itself, "i" is 330, and "j" is 23.  The average number
> of symbols was small - I don't have the number here right now, but
> I think it was around 10 symbols.  All of these numbers are a lot
> larger for a C++ program, obviously.
>
> Jason


  reply	other threads:[~2001-09-15 13:33 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-09  7:48 Jason Molenda
2001-09-10 11:24 ` Michael Snyder
2001-09-10 11:32   ` Jason Molenda
2001-09-10 11:50     ` Daniel Berlin
2001-09-10 11:52       ` Daniel Berlin
     [not found]       ` <20010910130347.A5628@shell17.ba.best.com>
2001-09-10 14:17         ` Daniel Berlin
2001-09-14  7:53           ` Andrew Cagney
2001-09-14  8:53             ` Daniel Berlin
2001-09-14  9:06             ` Eli Zaretskii
2001-09-14  9:13               ` Jason Molenda
2001-09-14  9:58                 ` Daniel Berlin
2001-09-14 10:55                   ` Eli Zaretskii
2001-09-14 10:52                 ` Eli Zaretskii
2001-09-14 10:59                   ` Daniel Jacobowitz
2001-09-14 11:57                     ` Eli Zaretskii
2001-09-15  0:54                   ` Jason Molenda
2001-09-15  3:43                     ` Eli Zaretskii
2001-09-15  8:01                       ` Daniel Berlin
2001-09-15  9:09                         ` Eli Zaretskii
2001-09-15 12:36                         ` Daniel Jacobowitz
2001-09-15 12:52                       ` Jason Molenda
2001-09-15  7:54                     ` Daniel Berlin
2001-09-15 13:08                       ` Jason Molenda
2001-09-15 13:33                         ` Daniel Berlin [this message]
2001-09-15 13:52                           ` Daniel Berlin
2001-09-15 14:02                             ` Jason Molenda
2001-09-15 14:21                               ` Daniel Berlin
2001-09-16  0:15                               ` Eli Zaretskii
2001-09-17 22:56                                 ` Andrew Cagney
2001-09-17 23:12                                   ` Jason Molenda
2001-09-18  6:21                                     ` Daniel Berlin
2001-09-18  7:32                                     ` Andrew Cagney
2001-09-17 23:18                                   ` Daniel Jacobowitz
2001-09-18  4:51                                     ` 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=C854422C-AA18-11D5-94ED-0030657B5340@cgsoftware.com \
    --to=dan@cgsoftware.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jason-swarelist@molenda.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