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-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.8 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 4063D1F4B4 for ; Fri, 9 Apr 2021 15:53:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233912AbhDIPxZ (ORCPT ); Fri, 9 Apr 2021 11:53:25 -0400 Received: from cloud.peff.net ([104.130.231.41]:46338 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233577AbhDIPxZ (ORCPT ); Fri, 9 Apr 2021 11:53:25 -0400 Received: (qmail 31835 invoked by uid 109); 9 Apr 2021 15:53:12 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Fri, 09 Apr 2021 15:53:12 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 12559 invoked by uid 111); 9 Apr 2021 15:53:11 -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; Fri, 09 Apr 2021 11:53:11 -0400 Authentication-Results: peff.net; auth=none Date: Fri, 9 Apr 2021 11:53:11 -0400 From: Jeff King To: Patrick Steinhardt Cc: git@vger.kernel.org, Christian Couder , Taylor Blau Subject: Re: [PATCH v2 7/8] pack-bitmap: implement combined filter Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Fri, Apr 09, 2021 at 12:31:42PM +0200, Patrick Steinhardt wrote: > > Hmm. This is essentially reproducing the list in filter_bitmap() of > > what's OK for bitmaps. So when adding a new filter, it would have to be > > added in both places. > > > > Can we preserve that property of the original code? I'd think that just > > adding LOFC_COMBINE to filter_bitmap() would be sufficient. I.e., this > > hunk: > > > > > + if (filter->choice == LOFC_COMBINE) { > > > + int i; > > > + for (i = 0; i < filter->sub_nr; i++) { > > > + filter_bitmap(bitmap_git, tip_objects, to_filter, > > > + &filter->sub[i]); > > > + } > > > + return 0; > > > + } > > > > ...except that we need to see if filter_bitmap() returns "-1" for any of > > the recursive calls. Which we probably should be doing anyway to > > propagate any errors (though I think the only "errors" we'd return are > > "not supported", at least for now). > > > > -Peff > > But wouldn't that mean that we're now needlessly filtering via bitmaps > all the way down the combined filters only to realize at the end that it > cannot work because we've got a tree filter with non-zero tree depth? > Granted, this will not be the common case. But it still feels like we're > doing needless work for cases where we know that bitmaps cannot answer > the query. I don't think so. We first call can_filter_bitmap(filter), which passes NULL for bitmap_git. And then in filter_bitmap(), we only do actual work if bitmap_git is non-NULL. This is the same thing that saves us from even loading the bitmaps (which is itself a non-trivial amount of work) if the filter cannot be satisfied by bitmaps. -Peff