git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.
Previous: Phillip WoodNext: Phillip Wood via GitGitGadget
Message 7 of 8 in “A couple of small patience diff cleanups”
  1. 0/2 A couple of small patience diff cleanupsPhillip Wood via GitGitGadget, May 4, 2021
  2. 1/2 patience diff: remove unnecessary string comparisonsPhillip Wood via GitGitGadget, May 4, 2021
  3. Junio C HamanoMay 5, 2021
  4. Phillip WoodMay 5, 2021
  5. Johannes SchindelinMay 5, 2021
  6. Phillip WoodMay 5, 2021
  7. Junio C HamanoMay 6, 2021
  8. 2/2 patience diff: remove unused variablePhillip Wood via GitGitGadget, May 4, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.