From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11383 invoked by alias); 24 Sep 2010 20:11:37 -0000 Received: (qmail 11360 invoked by uid 22791); 24 Sep 2010 20:11:34 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 24 Sep 2010 20:11:28 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8OKBQOP021006 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 24 Sep 2010 16:11:26 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8OKBQog016469 for ; Fri, 24 Sep 2010 16:11:26 -0400 Received: from [10.15.16.129] (dhcp-10-15-16-129.yyz.redhat.com [10.15.16.129]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o8OKBP38003561 for ; Fri, 24 Sep 2010 16:11:25 -0400 Message-ID: <4C9D05EE.50200@redhat.com> Date: Mon, 27 Sep 2010 09:27:00 -0000 From: sami wagiaalla User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Lightning/1.0b2pre Thunderbird/3.1.2 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: Re: [patch 2/4] Template Lookup References: <4C446F49.5070204@redhat.com> <4C76BDC8.9030209@redhat.com> <4C9B6898.1000300@redhat.com> In-Reply-To: <4C9B6898.1000300@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 2010-09/txt/msg00444.txt.bz2 On 09/23/2010 10:47 AM, sami wagiaalla wrote: > On 08/26/2010 03:17 PM, sami wagiaalla wrote: >>> >>> Sami> + /* Has a template symbol for this symbol been added already ? */ >>> Sami> + for (iterator = *(listhead); >>> Sami> + iterator != NULL; >>> Sami> + iterator = iterator->next) >>> >>> I think this means that adding template symbols is O(N^2). >>> A temporary hash table for recording this info would be better. >>> >> >> Hmm.. I can't think of an elegant way to do this. > > I think we can do this, [...] OK I re-changed my mind. I was thinking of creating a hash table of entries that look like this: struct template_hash_entry { /* Key. */ char *name; struct pending *list; /* Value. */ struct symbol *template_sym; }; problem is the list head for the various lists changes every time a new symbol is added. So in conclusion the requested change can not be done without a bit of refactoring. Thanks, Sami