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

Re: [RFH] xdiff shows trivially redundant diff.

From
DLDavide Libenzi <davidel@xmailserver.org>
Date
Apr 3, 2006, 03:26 UTC
Message-ID
<Pine.LNX.4.64.0604022022390.10401@alien.or.mcafeemobile.com>
In-Reply-To
<Pine.LNX.4.64.0604021749580.23419@g5.osdl.org>
On Sun, 2 Apr 2006, Linus Torvalds wrote:
Show 16 quoted lines
>
>
> On Sun, 2 Apr 2006, Davide Libenzi wrote:
>>
>> Yes, it does even vanilla libxdiff ;) It's not a problem though, since it is
>> created in xdl_cleanup_records() that tries to do a fast pass over the records
>> to try to simplify the real diff operation. In trying to be fast, only hashes
>> are compared, and it happens that the hash for "'')" collides with another one
>> (try to replace one of the "'')" chars with another one). Why is this not a
>> problem? Because what this lead to is only lines to be marked as changed, with
>> a probability of about N/2^(8 * sizeof(long) - 1), even though they are not.
>> And this happens only during sequential groups of lines changed, that is when
>> the hash-colliding line is either at the begin or the end of the run.
>
> Hmm. It's still ugly, though. No possibility to have a "clean up identical
> initial and final lines" stage to get rid of extraneous bogus diffs?

It does ;) If you make the second hunk (the one with the '') line) to be the first, the shrink-initial-and-final lines optimizations will make it eat the '') line.

> I look at diffs a lot, and while this may be rare, if I were to end up
> having to wonder what the difference is and it turns out that it's just
> due to a libxdelta thing, I'd be a bit irritated and wish it gave me a
> proper diff..
Tomorrow I'll take a look at it.
- Davide
Previous: Linus TorvaldsNext: Linus Torvalds
Message 8 of 17 in “[RFH] xdiff shows trivially redundant diff.”
  1. Junio C HamanoApr 2, 2006
  2. Davide LibenziApr 2, 2006
  3. Junio C HamanoApr 2, 2006
  4. Linus TorvaldsApr 2, 2006
  5. Davide LibenziApr 2, 2006
  6. Davide LibenziApr 2, 2006
  7. Linus TorvaldsApr 3, 2006
  8. Davide LibenziApr 3, 2006
  9. Linus TorvaldsApr 3, 2006
  10. Davide LibenziApr 3, 2006
  11. Junio C HamanoApr 3, 2006
  12. Davide LibenziApr 3, 2006
  13. Davide LibenziApr 3, 2006
  14. Junio C HamanoApr 3, 2006
  15. Davide LibenziApr 3, 2006
  16. Davide LibenziApr 3, 2006
  17. Junio C HamanoApr 4, 2006

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.