<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/read-cache.c, branch v2.13.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.13.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.13.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2017-06-13T20:27:02Z</updated>
<entry>
<title>Merge branch 'jh/close-index-before-stat' into maint</title>
<updated>2017-06-13T20:27:02Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-06-13T20:27:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f24e079cb6ecaa217e593c2d2620187044ba1b0d'/>
<id>urn:sha1:f24e079cb6ecaa217e593c2d2620187044ba1b0d</id>
<content type='text'>
The timestamp of the index file is now taken after the file is
closed, to help Windows, on which a stale timestamp is reported by
fstat() on a file that is opened for writing and data was written
but not yet closed.

* jh/close-index-before-stat:
  read-cache: close index.lock in do_write_index
</content>
</entry>
<entry>
<title>i18n: read-cache: typofix</title>
<updated>2017-05-01T02:08:02Z</updated>
<author>
<name>Peter Krefting</name>
<email>peter@softwolves.pp.se</email>
</author>
<published>2017-04-30T21:32:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=78bde923f16daccf590c78a619fbdbbe2a3d82ac'/>
<id>urn:sha1:78bde923f16daccf590c78a619fbdbbe2a3d82ac</id>
<content type='text'>
Signed-off-by: Peter Krefting &lt;peter@softwolves.pp.se&gt;
Signed-off-by: Jean-Noel Avila &lt;jn.avila@free.fr&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read-cache: close index.lock in do_write_index</title>
<updated>2017-04-28T03:40:24Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhost@microsoft.com</email>
</author>
<published>2017-04-26T20:05:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9f41c7a6b3e3cc3ac4a739364400393fa2492880'/>
<id>urn:sha1:9f41c7a6b3e3cc3ac4a739364400393fa2492880</id>
<content type='text'>
Teach do_write_index() to close the index.lock file
before getting the mtime and updating the istate.timestamp
fields.

On Windows, a file's mtime is not updated until the file is
closed.  On Linux, the mtime is set after the last flush.

Signed-off-by: Jeff Hostetler &lt;jeffhost@microsoft.com&gt;
Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'cc/split-index-config'</title>
<updated>2017-04-26T06:39:09Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-04-26T06:39:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3961c516990e99f648981918a95ab77bde5a0f37'/>
<id>urn:sha1:3961c516990e99f648981918a95ab77bde5a0f37</id>
<content type='text'>
The split-index code configuration code used an unsafe git_path()
function without copying its result out.

* cc/split-index-config:
  read-cache: avoid using git_path() in freshen_shared_index()
</content>
</entry>
<entry>
<title>Merge branch 'jh/add-index-entry-optim'</title>
<updated>2017-04-26T06:39:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-04-26T06:39:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6cbc478d83b5773d1925869e50bf6067306f4817'/>
<id>urn:sha1:6cbc478d83b5773d1925869e50bf6067306f4817</id>
<content type='text'>
"git checkout" that handles a lot of paths has been optimized by
reducing the number of unnecessary checks of paths in the
has_dir_name() function.

* jh/add-index-entry-optim:
  read-cache: speed up has_dir_name (part 2)
  read-cache: speed up has_dir_name (part 1)
  read-cache: speed up add_index_entry during checkout
  p0006-read-tree-checkout: perf test to time read-tree
  read-cache: add strcmp_offset function
</content>
</entry>
<entry>
<title>read-cache: avoid using git_path() in freshen_shared_index()</title>
<updated>2017-04-21T03:57:26Z</updated>
<author>
<name>Christian Couder</name>
<email>christian.couder@gmail.com</email>
</author>
<published>2017-03-30T21:03:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ccef2bb5fa752fac9351cabc61c1362c85d620ee'/>
<id>urn:sha1:ccef2bb5fa752fac9351cabc61c1362c85d620ee</id>
<content type='text'>
When performing an interactive rebase in split-index mode,
the commit message that one should rework when squashing commits
can contain some garbage instead of the usual concatenation of
both of the commit messages.

The code uses git_path() to compute the shared index filename, and
passes it to check_and_freshen_file() as its argument; there is no
guarantee that the rotating pathname buffer passed as argument will
stay valid during the life of this call.  Make our own copy before
calling the function and pass the copy as its argument to avoid this
risky pattern.

Signed-off-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read-cache: speed up has_dir_name (part 2)</title>
<updated>2017-04-20T03:33:01Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhost@microsoft.com</email>
</author>
<published>2017-04-19T17:06:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b986df5c35a930858c6bba5f66c18ce6760d84e9'/>
<id>urn:sha1:b986df5c35a930858c6bba5f66c18ce6760d84e9</id>
<content type='text'>
Teach has_dir_name() to see if the path of the new item
is greater than the last path in the index array before
attempting to search for it.

has_dir_name() is looking for file/directory collisions
in the index and has to consider each sub-directory
prefix in turn.  This can cause multiple binary searches
for each path.

During operations like checkout, merge_working_tree()
populates the new index in sorted order, so we expect
to be able to append in many cases.

This commit is part 2 of 2.  This commit handles the
additional possible short-cuts as we look at each
sub-directory prefix.

The net-net gains for add_index_entry_with_check() and
both had_dir_name() commits are best seen for very
large repos.

Here are results for an INFLATED version of linux.git
with 1M files.

$ GIT_PERF_REPO=/mnt/test/linux_inflated.git/ ./run upstream/base HEAD ./p0006-read-tree-checkout.sh
Test                                                            upstream/base      HEAD
0006.2: read-tree br_base br_ballast (1043893)                  3.79(3.63+0.15)    2.68(2.52+0.15) -29.3%
0006.3: switch between br_base br_ballast (1043893)             7.55(6.58+0.44)    6.03(4.60+0.43) -20.1%
0006.4: switch between br_ballast br_ballast_plus_1 (1043893)   10.84(9.26+0.59)   8.44(7.06+0.65) -22.1%
0006.5: switch between aliases (1043893)                        10.93(9.39+0.58)   10.24(7.04+0.63) -6.3%

Here are results for a synthetic repo with 4.2M files.

$ GIT_PERF_REPO=~/work/gfw/t/perf/repos/gen-many-files-10.4.3.git/ ./run HEAD~3 HEAD ./p0006-read-tree-checkout.sh
Test                                                            HEAD~3               HEAD
0006.2: read-tree br_base br_ballast (4194305)                  29.96(19.26+10.50)   23.76(13.42+10.12) -20.7%
0006.3: switch between br_base br_ballast (4194305)             56.95(36.08+16.83)   45.54(25.94+15.68) -20.0%
0006.4: switch between br_ballast br_ballast_plus_1 (4194305)   90.94(51.50+31.52)   78.22(39.39+30.70) -14.0%
0006.5: switch between aliases (4194305)                        93.72(51.63+34.09)   77.94(39.00+30.88) -16.8%

Results for medium repos (like linux.git) are mixed and have
more variance (probably do to disk IO unrelated to this test.

$ GIT_PERF_REPO=/mnt/test/linux.git/ ./run HEAD~3 HEAD ./p0006-read-tree-checkout.sh
Test                                                          HEAD~3             HEAD
0006.2: read-tree br_base br_ballast (57994)                  0.25(0.21+0.03)    0.20(0.17+0.02) -20.0%
0006.3: switch between br_base br_ballast (57994)             10.67(6.06+2.92)   10.51(5.94+2.91) -1.5%
0006.4: switch between br_ballast br_ballast_plus_1 (57994)   0.59(0.47+0.16)    0.52(0.40+0.13) -11.9%
0006.5: switch between aliases (57994)                        0.59(0.44+0.17)    0.51(0.38+0.14) -13.6%

$ GIT_PERF_REPO=/mnt/test/linux.git/ ./run HEAD~3 HEAD ./p0006-read-tree-checkout.sh
Test                                                          HEAD~3             HEAD
0006.2: read-tree br_base br_ballast (57994)                  0.24(0.21+0.02)    0.21(0.18+0.02) -12.5%
0006.3: switch between br_base br_ballast (57994)             10.42(5.98+2.91)   10.66(5.86+3.09) +2.3%
0006.4: switch between br_ballast br_ballast_plus_1 (57994)   0.59(0.49+0.13)    0.53(0.37+0.16) -10.2%
0006.5: switch between aliases (57994)                        0.59(0.43+0.17)    0.50(0.37+0.14) -15.3%

Results for smaller repos (like git.git) are not significant.
$ ./run HEAD~3 HEAD ./p0006-read-tree-checkout.sh
Test                                                         HEAD~3            HEAD
0006.2: read-tree br_base br_ballast (3043)                  0.01(0.00+0.00)   0.01(0.00+0.00) +0.0%
0006.3: switch between br_base br_ballast (3043)             0.31(0.17+0.11)   0.29(0.19+0.08) -6.5%
0006.4: switch between br_ballast br_ballast_plus_1 (3043)   0.03(0.02+0.00)   0.03(0.02+0.00) +0.0%
0006.5: switch between aliases (3043)                        0.03(0.02+0.00)   0.03(0.02+0.00) +0.0%

Signed-off-by: Jeff Hostetler &lt;jeffhost@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read-cache: speed up has_dir_name (part 1)</title>
<updated>2017-04-20T03:33:01Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhost@microsoft.com</email>
</author>
<published>2017-04-19T17:06:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=06b6d81b7929ce6f5542ba869e7bb9d8e437e6f8'/>
<id>urn:sha1:06b6d81b7929ce6f5542ba869e7bb9d8e437e6f8</id>
<content type='text'>
Teach has_dir_name() to see if the path of the new item
is greater than the last path in the index array before
attempting to search for it.

has_dir_name() is looking for file/directory collisions
in the index and has to consider each sub-directory
prefix in turn.  This can cause multiple binary searches
for each path.

During operations like checkout, merge_working_tree()
populates the new index in sorted order, so we expect
to be able to append in many cases.

This commit is part 1 of 2.  This commit handles the top
of has_dir_name() and the trivial optimization.

Signed-off-by: Jeff Hostetler &lt;jeffhost@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read-cache: speed up add_index_entry during checkout</title>
<updated>2017-04-20T03:33:01Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhost@microsoft.com</email>
</author>
<published>2017-04-19T17:06:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e5494631ed94017da862d55eb6393a0d01d8b91d'/>
<id>urn:sha1:e5494631ed94017da862d55eb6393a0d01d8b91d</id>
<content type='text'>
Teach add_index_entry_with_check() to see if the path
of the new item is greater than the last path in the
index array before attempting to search for it.

During checkout, merge_working_tree() populates the new
index in sorted order, so this change will save a binary
lookups per file.  This preserves the original behavior
but simply checks the last element before starting the
search.

This helps performance on very large repositories.

Signed-off-by: Jeff Hostetler &lt;jeffhost@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read-cache: add strcmp_offset function</title>
<updated>2017-04-15T09:21:12Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhost@microsoft.com</email>
</author>
<published>2017-04-14T19:12:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a6db3fbb6e4ec11695e2a3af8bc2cb9119cb1941'/>
<id>urn:sha1:a6db3fbb6e4ec11695e2a3af8bc2cb9119cb1941</id>
<content type='text'>
Add strcmp_offset() function to also return the offset of the
first change.

Add unit test and helper to verify.

Signed-off-by: Jeff Hostetler &lt;jeffhost@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
