From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id C08651F66E for ; Tue, 1 Sep 2020 09:27:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726446AbgIAJ1d (ORCPT ); Tue, 1 Sep 2020 05:27:33 -0400 Received: from cloud.peff.net ([104.130.231.41]:46052 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726117AbgIAJ1d (ORCPT ); Tue, 1 Sep 2020 05:27:33 -0400 Received: (qmail 25551 invoked by uid 109); 1 Sep 2020 09:27:32 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 01 Sep 2020 09:27:32 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 24849 invoked by uid 111); 1 Sep 2020 09:27:32 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Tue, 01 Sep 2020 05:27:32 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 1 Sep 2020 05:27:31 -0400 From: Jeff King To: Elijah Newren Cc: Elijah Newren via GitGitGadget , Git Mailing List Subject: Re: [PATCH 0/5] Add struct strmap and associated utility functions Message-ID: <20200901092731.GA1268661@coredump.intra.peff.net> References: <20200821201648.GH1165@coredump.intra.peff.net> <20200828070335.GB2105050@coredump.intra.peff.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Fri, Aug 28, 2020 at 08:29:44AM -0700, Elijah Newren wrote: > > It may also be a sign that we should be growing the hash more > > aggressively in the first place. Of course all of this is predicated > > having some benchmarks. It would be useful to know which part actually > > provided the speedup. > > Your thoughts here are great; I also had another one this past week -- > I could introduce a hashmap_partial_clear() (in addition to > hashmap_clear()) for the special usecase I have of leaving the table > allocated and pre-sized. It'd prevent people from accidentally using > it and forgetting to free stuff, while still allowing me to take > advantage. But, as you say, more benchmarks would be useful to find > which parts provided the speedup before taking any of these steps. Yeah, having a separate function to explicitly do "remove all elements but keep the table allocated" would be fine with me. My big desire is that clear() should do the safe, non-leaking thing by default. -Peff