From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98566 invoked by alias); 20 Nov 2019 04:42:53 -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 98517 invoked by uid 89); 20 Nov 2019 04:42:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=xfree X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 20 Nov 2019 04:42:51 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id D73562020A; Tue, 19 Nov 2019 23:42:48 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [8.43.85.239]) by mx1.osci.io (Postfix) with ESMTP id 82F6420250; Tue, 19 Nov 2019 23:42:47 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 5C1D12816F; Tue, 19 Nov 2019 23:42:47 -0500 (EST) X-Gerrit-PatchSet: 1 Date: Wed, 20 Nov 2019 04:42:00 -0000 From: "Simon Marchi (Code Review)" To: Christian Biesinger , gdb-patches@sourceware.org Auto-Submitted: auto-generated X-Gerrit-MessageType: comment Subject: [review] Create a correctly-sized demangled names hashtable X-Gerrit-Change-Id: I1f074d38e1d90af58705ec852f90c84cc034cd2e X-Gerrit-Change-Number: 686 X-Gerrit-ChangeURL: X-Gerrit-Commit: b5f0fe2db448850c0d332a0cd644d36046d975ff In-Reply-To: References: X-Gerrit-Comment-Date: Tue, 19 Nov 2019 23:42:46 -0500 Reply-To: gnutoolchain-gerrit@osci.io MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Content-Type: text/plain; charset=UTF-8 Message-Id: <20191120044247.5C1D12816F@gnutoolchain-gerrit.osci.io> X-SW-Source: 2019-11/txt/msg00617.txt.bz2 Simon Marchi has posted comments on this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/686 ...................................................................... Patch Set 1: (1 comment) | --- gdb/symtab.c | +++ gdb/symtab.c | @@ -771,10 +771,17 @@ create_demangled_names_hash (struct objfile_per_bfd_storage *per_bfd) | Choosing a much larger table size wastes memory, and saves only about | - 1% in symbol reading. */ | + 1% in symbol reading. However, if the minsym count is already | + initialized (e.g. because symbol name setting was deferred to | + a background thread) we can initialize the hashtable with that | + count, because we will almost certainly have at least that | + many entries. If we have a nonzero number but less than 256, | + we still stay with 256 to have some space for psymbols, etc. */ | + | + int count = std::max (per_bfd->minimal_symbol_count, 256); PS1, Line 779: > Looking at hashtab.c, I should perhaps do something like ((minimal_symbol_count+2)/3)*4, to more completely avoid hashtable resizings. Let me know if you have thoughts on that. Not sure why the +2, but I think it's a good idea to size the hashtable correctly from the start. I'd be fine with the (.../3)*4 with the comment explaining why we do that. This is performance critical code, so it's normal to do tweaks like that. Oh, is the +2 to make sure it rounds up the division by 3? | | per_bfd->demangled_names_hash.reset (htab_create_alloc | - (256, hash_demangled_name_entry, eq_demangled_name_entry, | + (count, hash_demangled_name_entry, eq_demangled_name_entry, | free_demangled_name_entry, xcalloc, xfree)); | } | | /* See symtab.h */ | -- Gerrit-Project: binutils-gdb Gerrit-Branch: master Gerrit-Change-Id: I1f074d38e1d90af58705ec852f90c84cc034cd2e Gerrit-Change-Number: 686 Gerrit-PatchSet: 1 Gerrit-Owner: Christian Biesinger Gerrit-Reviewer: Christian Biesinger Gerrit-CC: Simon Marchi Gerrit-Comment-Date: Wed, 20 Nov 2019 04:42:46 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: Christian Biesinger Gerrit-MessageType: comment