Re: [PATCH 1/2] patience diff: remove unnecessary string comparisons
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 6, 2021, 01:32 UTC
- Message-ID
- <xmqqo8do1wbh.fsf@gitster.g>
- In-Reply-To
- <nycvar.QRO.7.76.6.2105051649280.50@tvgsbejvaqbjf.bet>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 17 quoted lines
> 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.