<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/xdiff, branch v2.19.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.19.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.19.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2018-08-17T20:09:57Z</updated>
<entry>
<title>Merge branch 'sb/indent-heuristic-optim'</title>
<updated>2018-08-17T20:09:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-08-17T20:09:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=791ad494835ac544d9e91573f3a65aeb97d126ed'/>
<id>urn:sha1:791ad494835ac544d9e91573f3a65aeb97d126ed</id>
<content type='text'>
"git diff --indent-heuristic" had a bad corner case performance.

* sb/indent-heuristic-optim:
  xdiff: reduce indent heuristic overhead
</content>
</entry>
<entry>
<title>Merge branch 'sb/histogram-less-memory'</title>
<updated>2018-08-15T22:08:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-08-15T22:08:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=57fbd8efb0ac6d85bde612eb06b9ff4415e21503'/>
<id>urn:sha1:57fbd8efb0ac6d85bde612eb06b9ff4415e21503</id>
<content type='text'>
"git diff --histogram" had a bad memory usage pattern, which has
been rearranged to reduce the peak usage.

* sb/histogram-less-memory:
  xdiff/histogram: remove tail recursion
  xdiff/xhistogram: move index allocation into find_lcs
  xdiff/xhistogram: factor out memory cleanup into free_index()
  xdiff/xhistogram: pass arguments directly to fall_back_to_classic_diff
</content>
</entry>
<entry>
<title>xdiff: reduce indent heuristic overhead</title>
<updated>2018-08-01T20:36:22Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2018-07-27T22:23:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=301ef8540155316cb87c896866dd1cab3108807b'/>
<id>urn:sha1:301ef8540155316cb87c896866dd1cab3108807b</id>
<content type='text'>
Skip searching for better indentation heuristics if we'd slide a hunk more
than its size. This is the easiest fix proposed in the analysis[1] in
response to a patch that mercurial took for xdiff to limit searching
by a constant. Using a performance test as:

     #!python
     open('a', 'w').write(" \n" * 1000000)
     open('b', 'w').write(" \n" * 1000001)

This patch reduces the execution of "git diff --no-index a b" from
0.70s to 0.31s. However limiting the sliding to the size of the diff hunk,
which was proposed as a solution (that I found easiest to implement for
now) is not optimal for cases like

     open('a', 'w').write(" \n" * 1000000)
     open('b', 'w').write(" \n" * 2000000)

as then we'd still slide 1000000 times.

In addition to limiting the sliding to size of the hunk, also limit by a
constant. Choose 100 lines as the constant as that fits more than a screen,
which really means that the diff sliding is probably not providing a lot
of benefit anyway.

[1] https://public-inbox.org/git/72ac1ac2-f567-f241-41d6-d0f83072e0b3@alum.mit.edu/

Reported-by: Jun Wu &lt;quark@fb.com&gt;
Analysis-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xdiff/histogram: remove tail recursion</title>
<updated>2018-07-23T17:12:16Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2018-07-19T22:19:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=79cb2ebb92c18af11edf5eea238425d86eef173d'/>
<id>urn:sha1:79cb2ebb92c18af11edf5eea238425d86eef173d</id>
<content type='text'>
When running the same reproduction script as the previous patch,
it turns out the stack is too small, which can be easily avoided.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xdiff/xhistogram: move index allocation into find_lcs</title>
<updated>2018-07-19T19:46:03Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2018-07-19T18:56:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=64c4e8bccde9d357f6b7adf5277c3157b2bd0d42'/>
<id>urn:sha1:64c4e8bccde9d357f6b7adf5277c3157b2bd0d42</id>
<content type='text'>
This fixes a memory issue when recursing a lot, which can be reproduced as

    seq 1   100000 &gt;one
    seq 1 4 100000 &gt;two
    git diff --no-index --histogram one two

Before this patch, histogram_diff would call itself recursively before
calling free_index, which would mean a lot of memory is allocated during
the recursion and only freed afterwards. By moving the memory allocation
(and its free call) into find_lcs, the memory is free'd before we recurse,
such that memory is reused in the next step of the recursion instead of
using new memory.

This addresses only the memory pressure, not the run time complexity,
that is also awful for the corner case outlined above.

Helpful in understanding the code (in addition to the sparse history of
this file), was https://stackoverflow.com/a/32367597 which reproduces
most of the code comments of the JGit implementation.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xdiff/xhistogram: factor out memory cleanup into free_index()</title>
<updated>2018-07-19T19:46:01Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2018-07-19T18:56:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c671d4b5990f07ca40b0914ca9be65c626608fca'/>
<id>urn:sha1:c671d4b5990f07ca40b0914ca9be65c626608fca</id>
<content type='text'>
This will be useful in the next patch as we'll introduce multiple
callers.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xdiff/xhistogram: pass arguments directly to fall_back_to_classic_diff</title>
<updated>2018-07-19T19:46:00Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2018-07-19T18:56:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=282098506ffb42d151a3c8d324b6b5393a4342a4'/>
<id>urn:sha1:282098506ffb42d151a3c8d324b6b5393a4342a4</id>
<content type='text'>
By passing the 'xpp' and 'env' argument directly to the function
'fall_back_to_classic_diff', we eliminate an occurrence of the 'index'
in histogram_diff, which will prove useful in a bit.

While at it, move it up in the file. This will make the diff of
one of the next patches more legible.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xdiff/xdiffi.c: remove unneeded function declarations</title>
<updated>2018-07-17T18:25:31Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2018-07-16T23:05:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=21c770b63ea7ddcb6e52527d82089068b33eb9f3'/>
<id>urn:sha1:21c770b63ea7ddcb6e52527d82089068b33eb9f3</id>
<content type='text'>
There is no need to forward-declare these functions, as they are used
after their implementation only.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xdiff/xdiff.h: remove unused flags</title>
<updated>2018-07-17T18:25:31Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2018-07-16T23:05:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=25790be634afc3eb28a2ba8d0f6579aaab10bc27'/>
<id>urn:sha1:25790be634afc3eb28a2ba8d0f6579aaab10bc27</id>
<content type='text'>
These flags were there since the beginning (3443546f6e (Use a *real*
built-in diff generator, 2006-03-24), but were never used. Remove them.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jt/diff-anchored-patience'</title>
<updated>2017-12-19T19:33:56Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-12-19T19:33:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d7c6c2369ac21141b7c6cceaebc6414ec3da14ad'/>
<id>urn:sha1:d7c6c2369ac21141b7c6cceaebc6414ec3da14ad</id>
<content type='text'>
"git diff" learned a variant of the "--patience" algorithm, to
which the user can specify which 'unique' line to be used as
anchoring points.

* jt/diff-anchored-patience:
  diff: support anchoring line(s)
</content>
</entry>
</feed>
