From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 83911 invoked by alias); 8 Nov 2017 10:46:35 -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 83876 invoked by uid 89); 8 Nov 2017 10:46:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Speed, speeds X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 08 Nov 2017 10:46:32 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4D19715447; Wed, 8 Nov 2017 10:46:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4D19715447 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id A581A6E512; Wed, 8 Nov 2017 10:46:30 +0000 (UTC) Subject: Re: [RFA 1/2] Speed up dict_hash To: Tom Tromey , gdb-patches@sourceware.org References: <20171104161356.17565-1-tom@tromey.com> <20171104161356.17565-2-tom@tromey.com> From: Pedro Alves Message-ID: Date: Wed, 08 Nov 2017 10:46:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20171104161356.17565-2-tom@tromey.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-11/txt/msg00165.txt.bz2 On 11/04/2017 04:13 PM, Tom Tromey wrote: > This speeds up dict_hash a bit, by moving the "TKB" check into the > switch in the loop. > > For "gdb -nx -readnow -batch gdb", this improves the time from ~9.8s > before to ~8.5s afterward. Nice! > + case 'T': > + /* Ignore "TKB" suffixes. > + > + These are used by Ada for subprograms implementing a task body. > + For instance for a task T inside package Pck, the name of the > + subprogram implementing T's body is `pck__tTKB'. We need to > + ignore the "TKB" suffix because searches for this task body > + subprogram are going to be performed using `pck__t' (the encoded > + version of the natural name `pck.t'). */ > + if (strcmp (string, "TKB") == 0) > + return hash; This looks good to me. OOC, did you check whether 'if (strcmp (string + 1, "KB") == 0)' or even: if (string[1] == 'K' && string[2] == 'B' && string[3] == '\0') made a difference? Maybe there aren't enough 'T's in symbols to matter, or the compiler is already inlining that strcmp... Thanks, Pedro Alves