From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway33.websitewelcome.com (gateway33.websitewelcome.com [192.185.146.68]) by sourceware.org (Postfix) with ESMTPS id EEF25385DC00 for ; Sat, 4 Apr 2020 19:35:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EEF25385DC00 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway33.websitewelcome.com (Postfix) with ESMTP id F040F9E755 for ; Sat, 4 Apr 2020 14:35:27 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id KoZjjKQ6T8vkBKoZjj8acG; Sat, 04 Apr 2020 14:35:27 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=e/KCIOQs/hyrWPqo5/oVabEDXyIX6TIg8qKXDeP2Gjw=; b=l2MsZN/2MUhyB2AZuR/GOokdE1 1XhpgL40zJQPKyE19xJgr4Om1dPUQsH6F52berZaePSNlblGCIkdKPJQXKeJFWGGbHiAXiJ0xqxep CF4OtoOikoHzbgkyvZBJQCX4J; Received: from 174-16-110-145.hlrn.qwest.net ([174.16.110.145]:60090 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jKoZj-0022Wo-OQ; Sat, 04 Apr 2020 13:35:27 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Speed up psymbol reading by removing a copy Date: Sat, 4 Apr 2020 13:35:25 -0600 Message-Id: <20200404193525.11970-1-tom@tromey.com> X-Mailer: git-send-email 2.17.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.110.145 X-Source-L: No X-Exim-ID: 1jKoZj-0022Wo-OQ X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-110-145.hlrn.qwest.net (bapiya.Home) [174.16.110.145]:60090 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-18.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, JMQ_SPF_NEUTRAL, RCVD_IN_ABUSEAT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Sat, 04 Apr 2020 19:35:31 -0000 I noticed that cp_canonicalize_string and friends copy a unique_xmalloc_ptr to a std::string. However, this copy isn't genuinely needed anywhere, and it serves to slow down DWARF psymbol reading. This patch removes the copy and updates the callers to adapt. This speeds up the reader from 1.906 seconds (mean of 10 runs, of gdb on a copy of itself) to 1.888 seconds (mean of 10 runs, on the same copy as the first trial). gdb/ChangeLog 2020-04-04 Tom Tromey * symtab.h (class demangle_result_storage) : New overload. : Remove. * symtab.c (demangle_for_lookup, completion_list_add_symbol): Update. * stabsread.c (define_symbol, read_type): Update. * linespec.c (find_linespec_symbols): Update. * gnu-v3-abi.c (gnuv3_get_typeid): Update. * dwarf2/read.c (dwarf2_canonicalize_name): Update. * dbxread.c (read_dbx_symtab): Update. * cp-support.h (cp_canonicalize_string_full) (cp_canonicalize_string, cp_canonicalize_string_no_typedefs): Return unique_xmalloc_ptr. * cp-support.c (inspect_type): Update. (cp_canonicalize_string_full): Return unique_xmalloc_ptr. (cp_canonicalize_string_no_typedefs, cp_canonicalize_string): Likewise. * c-typeprint.c (print_name_maybe_canonical): Update. * break-catch-throw.c (check_status_exception_catchpoint): Update. --- gdb/ChangeLog | 23 +++++++++++++++++++++++ gdb/break-catch-throw.c | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c index 7c684de40b6..59293c4e570 100644 --- a/gdb/break-catch-throw.c +++ b/gdb/break-catch-throw.c @@ -148,7 +148,6 @@ check_status_exception_catchpoint (struct bpstats *bs) struct exception_catchpoint *self = (struct exception_catchpoint *) bs->breakpoint_at; std::string type_name; - gdb::unique_xmalloc_ptr canon; bkpt_breakpoint_ops.check_status (bs); if (bs->stop == 0) @@ -158,6 +157,7 @@ check_status_exception_catchpoint (struct bpstats *bs) return; const char *name = nullptr; + gdb::unique_xmalloc_ptr canon; try { struct value *typeinfo_arg; -- 2.17.2