From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id qBmDARflXGBMLwAAWB0awg (envelope-from ) for ; Thu, 25 Mar 2021 15:31:35 -0400 Received: by simark.ca (Postfix, from userid 112) id 041011EF7C; Thu, 25 Mar 2021 15:31:35 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 6866F1E789 for ; Thu, 25 Mar 2021 15:31:34 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EA0123858001; Thu, 25 Mar 2021 19:31:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EA0123858001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1616700694; bh=cJBpFs1qWwI5ncgSbCloZij/ka9kLsyDcUlFOMouPk4=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=izwQWBmtBZeNeScauRZBa6IlhG9zJrXzy1pgDt0t4AjlHPq2e3WRgF8DzD7X1xRhV 9Uj/PpGmqpu5au2+DMeFrU+H58F7ypVPKjkK1it4MKjs/ElGo0Vxa6PGy2bSiOr7rq IMBt4btjDRLcKilsWWHPSZhVyw0D0GiCzb/Rv9z4= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id D53563858001 for ; Thu, 25 Mar 2021 19:31:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D53563858001 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 12PJVPqA029889 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 15:31:30 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 12PJVPqA029889 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 57A681E789; Thu, 25 Mar 2021 15:31:25 -0400 (EDT) Subject: Re: [PATCH 2/2] Simplify psymbol_functions::expand_symtabs_matching To: Tom Tromey , gdb-patches@sourceware.org References: <20210324201510.23655-1-tom@tromey.com> <20210324201510.23655-3-tom@tromey.com> Message-ID: <9fde4c25-96b0-ac58-e453-41b0214572d9@polymtl.ca> Date: Thu, 25 Mar 2021 15:31:25 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210324201510.23655-3-tom@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 25 Mar 2021 19:31:25 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 2021-03-24 4:15 p.m., Tom Tromey wrote: > I noticed that psymbol_functions::expand_symtabs_matching calls > make_ignore_params once per psymtab that is matched. This seems > possibly expensive, so this patch hoists the call out of the loop. > > gdb/ChangeLog > 2021-03-24 Tom Tromey > > * psymtab.c (psymbol_functions::expand_symtabs_matching): Only > call make_ignore_params once. > --- > gdb/ChangeLog | 5 +++++ > gdb/psymtab.c | 6 +++++- > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/gdb/psymtab.c b/gdb/psymtab.c > index 5a64166d983..1ea7376a8c8 100644 > --- a/gdb/psymtab.c > +++ b/gdb/psymtab.c > @@ -1306,6 +1306,10 @@ psymbol_functions::expand_symtabs_matching > for (partial_symtab *ps : require_partial_symbols (objfile)) > ps->searched_flag = PST_NOT_SEARCHED; > > + gdb::optional psym_lookup_name; > + if (lookup_name != nullptr) > + psym_lookup_name = lookup_name->make_ignore_params (); > + > for (partial_symtab *ps : m_partial_symtabs->range ()) > { > QUIT; > @@ -1335,7 +1339,7 @@ psymbol_functions::expand_symtabs_matching > > if ((symbol_matcher == NULL && lookup_name == NULL) > || recursively_search_psymtabs (ps, objfile, domain, > - lookup_name->make_ignore_params (), > + *psym_lookup_name, > symbol_matcher)) > { > struct compunit_symtab *symtab = > This LGTM, thanks. Simon