From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56040 invoked by alias); 8 Nov 2017 22:41:28 -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 52049 invoked by uid 89); 8 Nov 2017 22:41:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=8560, H*M:7451 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 22:41:14 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C0BDC04AC49; Wed, 8 Nov 2017 22:41:13 +0000 (UTC) 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 4524160BE0; Wed, 8 Nov 2017 22:41:12 +0000 (UTC) Subject: Re: [RFA 1/2] Speed up dict_hash To: Tom Tromey References: <20171104161356.17565-1-tom@tromey.com> <20171104161356.17565-2-tom@tromey.com> <87y3ngr4p7.fsf@tromey.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: Date: Wed, 08 Nov 2017 22:41: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: <87y3ngr4p7.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-11/txt/msg00195.txt.bz2 On 11/08/2017 06:44 PM, Tom Tromey wrote: >>>>>> "Pedro" == Pedro Alves writes: > >>> For "gdb -nx -readnow -batch gdb", this improves the time from ~9.8s >>> before to ~8.5s afterward. > > Pedro> Nice! > > I rebuilt today and the baseline times were higher -- now it starts at > ~14.1s for an unmodified gdb, down to ~12.2 with my patch. I'm not sure > if this is due to some other patch, or if the additional time is because > I configured differently (I enabled guile, python, and all targets in > this most recent build). If so, 4 seconds (comparing to the ~10 seconds > last time around) seems awfully expensive for those features... I'm seeing a lot of time (24%!) spent in gettext, via complaints... perf shows: - 86.23% 0.00% gdb gdb [.] gdb_main - gdb_main - 85.60% catch_command_errors symbol_file_add_main_adapter symbol_file_add_main symbol_file_add_main_1 symbol_file_add - symbol_file_add_with_addrs - 84.31% dw2_expand_all_symtabs - dw2_instantiate_symtab - 83.79% dw2_do_instantiate_symtab - 70.85% process_die - 41.11% dwarf_decode_macros - 41.09% dwarf_decode_macro_bytes - 39.74% dwarf_decode_macro_bytes + 24.75% __dcigettext + 7.37% macro_define_object_internal + 3.16% macro_define_function 0.77% splay_tree_insert + 0.76% savestring + 0.58% free 0.53% read_indirect_string_at_offset_from 0.54% macro_define_object_internal 0.51% macro_start_file + 25.57% process_die + 4.07% dwarf_decode_lines + 4.28% compute_delayed_physnames + 3.85% end_symtab_from_static_block + 3.38% load_cu + 1.29% end_symtab_get_static_block + 0.52% do_my_cleanups + 1.29% read_symbols + 0.54% gdb_init Maybe you were building with --disable-intl before? The problem is that we're computing the arguments to pass to complaint, including passing the format strings through gettext, even when complaints are disabled... The patch below, improves "gdb -nx -readnow -batch gdb" from ~11.s to ~7.8s, for me (gcc 5.3.1, -O2, x86_64). >From c171f5097e05fa25553d92b9f9d14bf46207edc2 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 8 Nov 2017 21:03:15 +0000 Subject: [PATCH] complaints --- gdb/complaints.c | 4 ++-- gdb/complaints.h | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/gdb/complaints.c b/gdb/complaints.c index 58b6b7b..22a5f69 100644 --- a/gdb/complaints.c +++ b/gdb/complaints.c @@ -148,7 +148,7 @@ find_complaint (struct complaints *complaints, const char *file, before we stop whining about it? Default is no whining at all, since so many systems have ill-constructed symbol files. */ -static int stop_whining = 0; +int stop_whining = 0; /* Print a complaint, and link the complaint block into a chain for later handling. */ @@ -236,7 +236,7 @@ vcomplaint (struct complaints **c, const char *file, } void -complaint (struct complaints **complaints, const char *fmt, ...) +complaint_1 (struct complaints **complaints, const char *fmt, ...) { va_list args; diff --git a/gdb/complaints.h b/gdb/complaints.h index 54c2b18..b6fa0e2 100644 --- a/gdb/complaints.h +++ b/gdb/complaints.h @@ -29,9 +29,20 @@ struct complaints; extern struct complaints *symfile_complaints; /* Register a complaint. */ -extern void complaint (struct complaints **complaints, - const char *fmt, - ...) ATTRIBUTE_PRINTF (2, 3); +extern void complaint_1 (struct complaints **complaints, + const char *fmt, + ...) ATTRIBUTE_PRINTF (2, 3); + +#define complaint(COMPLAINTS, FMT, ...) \ + do \ + { \ + extern int stop_whining; \ + \ + if (stop_whining > 0) \ + complaint_1 (COMPLAINTS, FMT, ##__VA_ARGS__); \ + } \ + while (0) + extern void internal_complaint (struct complaints **complaints, const char *file, int line, const char *fmt, -- 2.5.5