Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Marc Khouzam" <marc.khouzam@ericsson.com>
To: "Nick Roberts" <nickrob@snap.net.nz>
Cc: <gdb-patches@sourceware.org>
Subject: RE: [PATCH:MI] Return a subset of a variable object's children
Date: Thu, 01 May 2008 14:22:00 -0000	[thread overview]
Message-ID: <6D19CA8D71C89C43A057926FE0D4ADAA04E1BD0C@ecamlmw720.eamcs.ericsson.se> (raw)
In-Reply-To: <18457.45600.692401.191218@kahikatea.snap.net.nz>


> The double loop is O(N*N).  I guess it could be reduced to O(N*log(N))
> using some kind of sorting algorithm.
>
> > To me, the advantage of your
> > patch is far larger in the fact that we no longer need to create all
> > children varObj at once; my impression is that the memory allocation is a
> > small optimization in caparison.  Is that a correct impression?  Besides,
> > currently, the memory is immediately allocated, so things wouldn't be any
> > worse :-)
>
>It's not just a question of memory allocation.  It's computationally
>inefficient because Gdb has to traverse a large sparsely populated vector every
>time it operates on it.  It wouldn't be any _worse_ than current Gdb, but I was
>trying to make it significantly _better_.

You are right.  I was focusing on making the proposed algorithm more efficient
but I didn't think about the other uses of the vector of children.

So, as you mention above, keeping the vector ordered (without empty spaces),
can reduce to O(N*log(N)).  If fact, I think it would be reduced to O(log(N))
since we would only need to find the location of the first new child; the position
of all other new children created in the same var-list-children can be determined
from that first position.
The expense would be in the insertion though, as the vector would have to be
mem-copied N times, one for each child that is not at the end of the vector.
I wonder if that is acceptable...

Marc



  reply	other threads:[~2008-05-01 14:22 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-27 15:34 Nick Roberts
2008-04-29 15:58 ` Marc Khouzam
2008-04-30  7:02   ` Nick Roberts
2008-04-30  9:20     ` Vladimir Prus
2008-04-30  9:25       ` Nick Roberts
2008-04-30  9:39         ` Vladimir Prus
2008-04-30 16:29           ` Marc Khouzam
2008-05-01 15:56             ` Vladimir Prus
2008-05-01 17:29               ` Marc Khouzam
2008-05-01 12:15           ` Nick Roberts
2008-05-10 14:45             ` Nick Roberts
2008-05-28 19:15               ` Vladimir Prus
2008-05-29 12:01                 ` Nick Roberts
2008-04-30 16:22         ` Marc Khouzam
2008-05-01 15:54           ` Vladimir Prus
2008-05-01 18:14             ` Marc Khouzam
2008-05-01 18:40               ` Vladimir Prus
2008-05-01 20:49                 ` Daniel Jacobowitz
2008-05-01 23:38                   ` Nick Roberts
2008-05-02  0:58                 ` Marc Khouzam
2008-05-11 17:45                   ` Vladimir Prus
2008-04-30 10:47       ` André Pönitz
2008-04-30 12:20         ` Vladimir Prus
2008-04-30 12:53           ` André Pönitz
2008-04-30 13:11             ` Vladimir Prus
2008-04-30 12:44         ` Nick Roberts
     [not found]           ` <200804301244.55116.apoenitz@trolltech.com>
2008-04-30 13:16             ` André Pönitz
2008-05-01  6:27               ` Nick Roberts
2008-05-05 11:46                 ` André Pönitz
2008-04-30 14:59     ` Marc Khouzam
2008-05-01 12:06       ` Nick Roberts
2008-05-01 14:22         ` Marc Khouzam [this message]
2008-05-01 20:41     ` Daniel Jacobowitz
2008-04-30  8:59 ` Vladimir Prus

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=6D19CA8D71C89C43A057926FE0D4ADAA04E1BD0C@ecamlmw720.eamcs.ericsson.se \
    --to=marc.khouzam@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nickrob@snap.net.nz \
    /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