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

Re: [PATCH 1/3] diff histogram: intern strings

From
Jeff King <peff@peff.net>
Date
Nov 19, 2021, 14:45 UTC
Message-ID
<YZe4hqF6Jf14L5tb@coredump.intra.peff.net>
In-Reply-To
<86d38148-7b97-76aa-148b-346cc179615a@gmail.com>
On Fri, Nov 19, 2021 at 10:05:32AM +0000, Phillip Wood wrote:
Show 19 quoted lines
> On 18/11/2021 15:42, Jeff King wrote:
> > On Thu, Nov 18, 2021 at 04:35:48PM +0100, Johannes Schindelin wrote:
> > 
> > > I think the really important thing to point out is that
> > > `xdl_classify_record()` ensures that the `ha` attribute is different for
> > > different text. AFAIR it even "linearizes" the `ha` values, i.e. they
> > > won't be all over the place but start at 0 (or 1).
> > > 
> > > So no, I'm not worried about collisions. That would be a bug in
> > > `xdl_classify_record()` and I think we would have caught this bug by now.
> > 
> > Ah, thanks for that explanation. That addresses my collision concern from
> > earlier in the thread completely.
> 
> Yes, thanks for clarifying I should have been clearer in my reply to Stolee.
> The reason I was waffling on about file sizes is that there can only be a
> collision if there are more than 2^32 unique lines. I think the minimum file
> size where that happens is just below 10GB when one side of the diff has
> 2^31 lines and the other has 2^31 + 1 lines and all the lines are unique.

Right, that makes more sense (and we are not likely to lift the 1GB limit anytime soon; there are tons of 32-bit variables and potential integer overflows all through the xdiff code).

It's probably worth explaining this a bit in the commit message.

I also, FWIW, found the subject confusing. I expected "intern" to refer to keeping a single copy of some strings. Maybe:

  Subject: diff histogram: skip xdl_recmatch for comparing records
or something?
-Peff
Previous: Phillip WoodNext: Ævar Arnfjörð Bjarmason
Message 9 of 15 in “xdiff: speedup histogram diff”
  1. 0/3 xdiff: speedup histogram diffPhillip Wood via GitGitGadget, Nov 17, 2021
  2. 1/3 diff histogram: intern stringsPhillip Wood via GitGitGadget, Nov 17, 2021
  3. Derrick StoleeNov 17, 2021
  4. Jeff KingNov 17, 2021
  5. Phillip WoodNov 17, 2021
  6. Johannes SchindelinNov 18, 2021
  7. Jeff KingNov 18, 2021
  8. Phillip WoodNov 19, 2021
  9. Jeff KingNov 19, 2021
  10. Ævar Arnfjörð BjarmasonNov 19, 2021
  11. Jeff KingNov 19, 2021
  12. Johannes SchindelinNov 19, 2021
  13. 2/3 xdiff: avoid unnecessary memory allocationsPhillip Wood via GitGitGadget, Nov 17, 2021
  14. 3/3 xdiff: simplify comparisonPhillip Wood via GitGitGadget, Nov 17, 2021
  15. Johannes SchindelinNov 18, 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.