From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9410 invoked by alias); 22 Dec 2014 17:33:17 -0000 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 Received: (qmail 9396 invoked by uid 89); 22 Dec 2014 17:33:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f182.google.com Received: from mail-pd0-f182.google.com (HELO mail-pd0-f182.google.com) (209.85.192.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 22 Dec 2014 17:33:13 +0000 Received: by mail-pd0-f182.google.com with SMTP id p10so6169238pdj.41 for ; Mon, 22 Dec 2014 09:33:11 -0800 (PST) X-Received: by 10.70.2.101 with SMTP id 5mr36958793pdt.103.1419269591199; Mon, 22 Dec 2014 09:33:11 -0800 (PST) Received: from seba.sebabeach.org.gmail.com (173-13-178-53-sfba.hfc.comcastbusiness.net. [173.13.178.53]) by mx.google.com with ESMTPSA id a6sm17728197pbu.64.2014.12.22.09.33.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Dec 2014 09:33:10 -0800 (PST) From: Doug Evans To: gdb-patches@sourceware.org Subject: Re: [PATCH 0/5] cp-namespace.c cleanup pass References: Date: Mon, 22 Dec 2014 17:33:00 -0000 In-Reply-To: (Doug Evans's message of "Sun, 14 Dec 2014 21:49:17 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-12/txt/msg00607.txt.bz2 Doug Evans writes: > Hi. > > This patch set is a cleanup pass over cp-namespace.c. > > There are two things I wish to achieve here: > > 1a) Remove redundancy to make the code more readable. > There are several redundant lookups here, and it's hard to reason > about the code because one has to ask if there's something one is > missing or whether the lookup really is redundant. Plus it's more > code to have to follow while studying the flow of any particular > function. > > 1b) Performance. > While redundant lookups don't always hurt performance if a symbol is > found, efficient handling of the null case (symbol not found) is at > least as important. > > 2) Lay the groundwork so that I can finish this patch, that adds support > for looking up primitive types as symbols: > https://sourceware.org/ml/gdb-patches/2014-12/msg00169.html > > 1/5: whitespace > 2/5: simplify cp_lookup_symbol_in_namespace > 3/5: introduce cp_lookup_nested_symbol_1 > 4/5: remove redundant calls to cp_lookup_symbol_in_namespace > 5/5: remove redundancies in cp_lookup_symbol_nonlocal > > Appended is a patch I wrote to log symbol lookup calls while > running the testsuite, and here are the before/after numbers: > > [dje@seba gdb]$ sed -e "s/ *(.*$//" before.tmp > [dje@seba gdb]$ sort before.tmp | uniq -c > 40230 basic_lookup_symbol_nonlocal > 74647 lookup_global_symbol > 18834 lookup_language_this > 73063 lookup_local_symbol > 30849 lookup_static_symbol > 73063 lookup_symbol_aux > 59411 lookup_symbol_in_block > 656240 lookup_symbol_in_objfile > 23 lookup_symbol_in_objfile_from_linkage_name > 656298 lookup_symbol_in_objfile_symtabs > 74075 lookup_symbol_in_static_block > 614899 lookup_symbol_via_quick_fns > > [dje@seba gdb]$ sed -e "s/ *(.*$//" after.tmp > [dje@seba gdb]$ sort after.tmp | uniq -c > 39019 basic_lookup_symbol_nonlocal > 61959 lookup_global_symbol > 9614 lookup_language_this > 71826 lookup_local_symbol > 29565 lookup_static_symbol > 71826 lookup_symbol_aux > 55214 lookup_symbol_in_block > 504688 lookup_symbol_in_objfile > 23 lookup_symbol_in_objfile_from_linkage_name > 504746 lookup_symbol_in_objfile_symtabs > 63217 lookup_symbol_in_static_block > 463884 lookup_symbol_via_quick_fns > > There's a clear reduction in the number of symbol looks being done here. > A later patch will augment our performance testsuite, but my main focus > at the moment is getting to the "use the index better" speedup patch. > [And along the way cleaning things up so that I understand the code > better, and *hopefully* making it so that others will too.] Hi. fyi, I committed this series.