From patchwork Fri Feb 10 14:21:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 64677 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DDA9C385B513 for ; Fri, 10 Feb 2023 14:22:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDA9C385B513 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676038951; bh=/Mf2ftF5IXUkfDQxQQP5vOEUtOA46jz/RTCiPdcB91Q=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=e8KFvT8BGH30we6hkm7tY2y9kTQ1+gNF+wGzEPi/EyEcveYU+7C5Cjd5LXuNPiEqN ZOIyMbDsepr7tp1daXTfhc2FVKS3px09UCfiMTem52jmGBZ8XvjOX5k3BfcROWWkOs 3tpTTD0uZj4hYJBGRkzMB3SdPFu7TnmgYe3vrOw0= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by sourceware.org (Postfix) with ESMTPS id 9551C385B537 for ; Fri, 10 Feb 2023 14:21:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9551C385B537 Received: by mail-il1-x130.google.com with SMTP id u8so2195116ilq.13 for ; Fri, 10 Feb 2023 06:21:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/Mf2ftF5IXUkfDQxQQP5vOEUtOA46jz/RTCiPdcB91Q=; b=q6e80v4F0q9mrogmbkBSyGx7x7sJeusRQaNhhAiOMPMcyvzHGfAKsFdmYBK/qFJscL sBYaA4EYoHTpvYHoimfYiK14Dy0vG17mD8Digim57oXLgVg3YN3nc0Qz4IdGsiW6ZL78 CbGTzXAql3CXzWLqXsDLyXtiXM/Eky+VcZ+rRv3Qc7L7bx+yDyKn8pdnwv2FLYX2JgFQ KK7A0jtAe25TlUJGtQ31usTsy6SgAaQedmOeBZyKzvB+jqgpD6cIOhlfA27tifIExloM c/fKHiHja7g6jknawTxH/7sb3O4oa1+kTMebKx7pfbMBCxAjqqrfLGRIUheC0SVy7YhH wFDQ== X-Gm-Message-State: AO0yUKVpZ5D8yu2NDjK+o9HsT6t+/n8VTLNm0Ffo4uig2FlhNiuxBjd/ 9id0C3KZaH6oJJd8oxPCmHsyyJ+/viJCEPGt X-Google-Smtp-Source: AK7set+adswIyxXnOhvZDYs0NgeXzE/3INHZP0mNuK0Nr9s759xPIr6bC+K2LcQwuo8OjnrTi+W0TA== X-Received: by 2002:a05:6e02:216c:b0:313:e73b:d3dd with SMTP id s12-20020a056e02216c00b00313e73bd3ddmr9298672ilv.13.1676038902833; Fri, 10 Feb 2023 06:21:42 -0800 (PST) Received: from localhost.localdomain (75-166-130-93.hlrn.qwest.net. [75.166.130.93]) by smtp.gmail.com with ESMTPSA id t1-20020a92cc41000000b0031418401f88sm520206ilq.69.2023.02.10.06.21.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 06:21:42 -0800 (PST) To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFC] Populate seen_names hash in cooked_index_shard::do_finalize Date: Fri, 10 Feb 2023 07:21:32 -0700 Message-Id: <20230210142132.2039087-1-tromey@adacore.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Tom Tromey via Gdb-patches From: Tom Tromey Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Hannes pointed out that cooked_index_shard::do_finalize never populates the seen_names hash table. This patch adds the necessary store. This reduces memory use a little for "gdb gdb": (before) Space used: 28909568 (+0 for this command) (after) Space used: 28884992 (+0 for this command) ... about 24k. So maybe it's better to just remove this hash? What this means, btw, is that in gdb there are not many symbols that are both mentioned in many CUs and that also require name canonicalization. It's possible this would differ in other programs. --- gdb/dwarf2/cooked-index.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c index 3d23a65ad8f..71852237f98 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -356,6 +356,7 @@ cooked_index_shard::do_finalize () entry->canonical = canon_name.get (); m_names.push_back (std::move (canon_name)); } + *slot = entry; } else {