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: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id E31DC1F4D7 for ; Tue, 17 May 2022 10:28:08 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=pobox.com header.i=@pobox.com header.b="QZRYgIy5"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239567AbiEQK1y (ORCPT ); Tue, 17 May 2022 06:27:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344777AbiEQK1g (ORCPT ); Tue, 17 May 2022 06:27:36 -0400 Received: from pb-smtp21.pobox.com (pb-smtp21.pobox.com [173.228.157.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFC0ACEE for ; Tue, 17 May 2022 03:27:10 -0700 (PDT) Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 3F720197DE6; Tue, 17 May 2022 06:27:09 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:message-id:mime-version:content-type; s=sasl; bh=OvrYlvRlS/AJpqcJYrsILLh4sekkXyhW2a7PytQmGfQ=; b=QZRY gIy580oSWN95LkyQPiTwQhLUgjQvUBlFmFmXpp8gwHFEyPiFGgPdOi+UrKafnLoA a3opoYvxp3nfGzMYU1QVkIwpFjMDxVyQaxBgmts2MMQsbRo6mBcB6Bsgi+EVvBTd 6Z9bNtVl3DuO/XiNcQM5+FeyulNuaQuN0THc07Y= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 3977E197DE5; Tue, 17 May 2022 06:27:09 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.83.65.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id D4349197DE4; Tue, 17 May 2022 06:27:05 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: Orgad Shaneh Cc: Orgad Shaneh via GitGitGadget , git Subject: Re: [PATCH v2] fetch: limit shared symref check only for local branches References: Date: Tue, 17 May 2022 03:27:04 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: E63353DA-D5CB-11EC-B534-CBA7845BAAA9-77302942!pb-smtp21.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Orgad Shaneh writes: >> Another thing that is surprising is that you say this loop is >> expensive when there are many tags or branches. Do you mean it is >> expensive when there are many tags and branches that are updated, or >> it is expensive to merely have thousands of dormant tags and >> branches? If the latter, I wonder if it is sensible to limit the >> check only to the refs that are going to be updated. > > It's expensive even when *nothing* is updated. I have a repo with 44K > tags, 13K of the tags are annotated, 134 remote branches and 4 > worktrees (except the main repo) with 33 local branches. > > I counted the calls to find_shared_symref - it was called 35755 times, > and refs_read_raw_ref was called 357585 times. That is exactly why I asked, as the above number hints that it could be a viable optimization to omit calls for refs whose old_ and new_oid are the same, just like you omit calls for refs that are not inside refs/heads/ in your patch, perhaps?