From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72751 invoked by alias); 4 Nov 2017 16:14:03 -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 72714 invoked by uid 89); 4 Nov 2017 16:14:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=UD:t, ts X-HELO: gateway23.websitewelcome.com Received: from gateway23.websitewelcome.com (HELO gateway23.websitewelcome.com) (192.185.50.164) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 04 Nov 2017 16:14:00 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 2E9AC92D4 for ; Sat, 4 Nov 2017 11:13:59 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id B155e6kcVrWstB155epne8; Sat, 04 Nov 2017 11:13:59 -0500 Received: from 71-218-90-63.hlrn.qwest.net ([71.218.90.63]:32796 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eB154-003mhN-VG; Sat, 04 Nov 2017 11:13:59 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 1/2] Speed up dict_hash Date: Sat, 04 Nov 2017 16:14:00 -0000 Message-Id: <20171104161356.17565-2-tom@tromey.com> In-Reply-To: <20171104161356.17565-1-tom@tromey.com> References: <20171104161356.17565-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1eB154-003mhN-VG X-Source-Sender: 71-218-90-63.hlrn.qwest.net (bapiya.Home) [71.218.90.63]:32796 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-SW-Source: 2017-11/txt/msg00093.txt.bz2 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. gdb/ChangeLog 2017-11-04 Tom Tromey * dictionary.c (dict_hash): Move "TKB" check into the "switch". --- gdb/ChangeLog | 4 ++++ gdb/dictionary.c | 32 ++++++++++++++++---------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/gdb/dictionary.c b/gdb/dictionary.c index b2cfca28ab..702cd60c2a 100644 --- a/gdb/dictionary.c +++ b/gdb/dictionary.c @@ -796,17 +796,6 @@ dict_hash (const char *string0) hash = 0; while (*string) { - /* 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; - switch (*string) { case '$': @@ -828,14 +817,25 @@ dict_hash (const char *string0) return hash; hash = 0; string += 2; - break; + continue; } - /* FALL THROUGH */ - default: - hash = SYMBOL_HASH_NEXT (hash, *string); - string += 1; + break; + 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; break; } + + hash = SYMBOL_HASH_NEXT (hash, *string); + string += 1; } return hash; } -- 2.13.6