From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19788 invoked by alias); 30 Apr 2008 14:21:34 -0000 Received: (qmail 19752 invoked by uid 22791); 30 Apr 2008 14:21:32 -0000 X-Spam-Check-By: sourceware.org Received: from imr1.ericy.com (HELO imr1.ericy.com) (198.24.6.9) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 30 Apr 2008 14:21:09 +0000 Received: from eusrcmw750.eamcs.ericsson.se (eusrcmw750.exu.ericsson.se [138.85.77.50]) by imr1.ericy.com (8.13.1/8.13.1) with ESMTP id m3UEL52W027237; Wed, 30 Apr 2008 09:21:05 -0500 Received: from ecamlmw720.eamcs.ericsson.se ([142.133.1.72]) by eusrcmw750.eamcs.ericsson.se with Microsoft SMTPSVC(6.0.3790.1830); Wed, 30 Apr 2008 09:21:05 -0500 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [PATCH:MI] Return a subset of a variable object's children Date: Wed, 30 Apr 2008 16:29:00 -0000 Message-ID: <6D19CA8D71C89C43A057926FE0D4ADAA042910B7@ecamlmw720.eamcs.ericsson.se> In-Reply-To: <200804301109.20906.vladimir@codesourcery.com> From: "Marc Khouzam" To: "Vladimir Prus" , "Nick Roberts" Cc: X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-04/txt/msg00703.txt.bz2 > > > > > but only actually create the children that have been requested by= the > > > > > user. I'm not sure how much efficiency there is by allocating the > > > > > memory before hand? Also, is there no way to grow the vector by = more > > > > > than a single point at a time? > > > >=20 > > > > Like resize with STL vectors? I'm not aware of one. > > >=20 > > > VEC_safe_grow > >=20 > > OK, I didn't know about that. Why not use it instead of VEC_safe_push = in the > > construct above? >=20 > Well, it happens not to initialize the data, so some changes in further l= ogic will > be required. Until now, it was not a performance issue. My concern about while (VEC_length (varobj_p, var->children) < var->num_children) VEC_safe_push (varobj_p, var->children, NULL); is that the vector may be reallocated multiple times. How about something like this (assuming quick_push does what I think it doe= s) var->children =3D VEC_alloc(varobj_p, var->num_children); for (i=3D0; inum_children; i++) VEC_quick_push (varobj_p, var->children, NULL); Same loop, but it avoids having to reallocate the vector. Just a thought, not related to Nick's patch. Marc