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=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,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 0E1CB1F5AE for ; Thu, 6 May 2021 01:32:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230246AbhEFBdR (ORCPT ); Wed, 5 May 2021 21:33:17 -0400 Received: from pb-smtp2.pobox.com ([64.147.108.71]:50386 "EHLO pb-smtp2.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229465AbhEFBdR (ORCPT ); Wed, 5 May 2021 21:33:17 -0400 Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 8695ED3862; Wed, 5 May 2021 21:32:19 -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:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=/2ceqBAlnzF1+jjQwr6wJd4lkFJKL9YnELWjkF i3P48=; b=eiYEe66C7tE4UQrjkBIS/BcakzPxVXWZ+iP9a9+m7RI7F1vOeDTv1u davjywZ3tw1pHeZDrWOJyRQINTaHLqR4vDYSZWUFR+mUaaruOKydSSE2c11Bmz2e zpbhoTCA79rvIj4D6UWLupoOrUS34Z+R4uKLd0MWujbUMAmCO6SJw= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 7DFFDD3861; Wed, 5 May 2021 21:32:19 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.74.119.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id 07F17D3860; Wed, 5 May 2021 21:32:19 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: Johannes Schindelin Cc: Phillip Wood via GitGitGadget , git@vger.kernel.org, Phillip Wood Subject: Re: [PATCH 1/2] patience diff: remove unnecessary string comparisons References: Date: Thu, 06 May 2021 10:32:18 +0900 In-Reply-To: (Johannes Schindelin's message of "Wed, 5 May 2021 16:58:38 +0200 (CEST)") 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: E5A2AC0C-AE0A-11EB-A9DC-74DE23BA3BAF-77302942!pb-smtp2.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Johannes Schindelin writes: > Right. I had the same concern. But it does look as if > `xdl_classify_record()` replaced the possibly non-unique hash values to > unique sequential identifiers. > > I have to admit that the code is unnecessarily hard to read for me: > https://github.com/git/git/blob/v2.31.1/xdiff/xprepare.c#L110-L157 > > But I do gather that the loop at > https://github.com/git/git/blob/v2.31.1/xdiff/xprepare.c#L119-L123 > is called for every line, that it does compare it to every seen line with > the same hash, and that it exits the loop early if the contents disagree: > > for (rcrec = cf->rchash[hi]; rcrec; rcrec = rcrec->next) > if (rcrec->ha == rec->ha && > xdl_recmatch(rcrec->line, rcrec->size, > rec->ptr, rec->size, cf->flags)) > break; Yeah, I arrived at the same conclusion. Also as Phillip said in a separate message, Myers side already takes advantage of this same fact, so I am fine with this change. Thanks, both.