<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/object-file.c, branch v2.33.6</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.33.6</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.33.6'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2021-08-11T19:36:17Z</updated>
<entry>
<title>Merge branch 'cb/many-alternate-optim-fixup'</title>
<updated>2021-08-11T19:36:17Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-08-11T19:36:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7cfaa86fe6f61698752d13c59ac97a102d1fbaae'/>
<id>urn:sha1:7cfaa86fe6f61698752d13c59ac97a102d1fbaae</id>
<content type='text'>
Build fix.

* cb/many-alternate-optim-fixup:
  object-file: use unsigned arithmetic with bit mask
  object-store: avoid extra ';' from KHASH_INIT
  oidtree: avoid nested struct oidtree_node
</content>
</entry>
<entry>
<title>object-file: use unsigned arithmetic with bit mask</title>
<updated>2021-08-11T17:19:56Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2021-08-06T17:53:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=581a3bb155c157094ca486e3a10c4a9b70c8f650'/>
<id>urn:sha1:581a3bb155c157094ca486e3a10c4a9b70c8f650</id>
<content type='text'>
33f379eee6 (make object_directory.loose_objects_subdir_seen a bitmap,
2021-07-07) replaced a wasteful 256-byte array with a 32-byte array
and bit operations.  The mask calculation shifts a literal 1 of type
int left by anything between 0 and 31.  UndefinedBehaviorSanitizer
doesn't like that and reports:

object-file.c:2477:18: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

Make sure to use an unsigned 1 instead to avoid the issue.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ew/many-alternate-optim'</title>
<updated>2021-07-28T20:17:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-07-28T20:17:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e5cc59c77c875aeda93a3cdfe70c8254164324ab'/>
<id>urn:sha1:e5cc59c77c875aeda93a3cdfe70c8254164324ab</id>
<content type='text'>
Optimization for repositories with many alternate object store.

* ew/many-alternate-optim:
  oidtree: a crit-bit tree for odb_loose_cache
  oidcpy_with_padding: constify `src' arg
  make object_directory.loose_objects_subdir_seen a bitmap
  avoid strlen via strbuf_addstr in link_alt_odb_entry
  speed up alt_odb_usable() with many alternates
</content>
</entry>
<entry>
<title>Merge branch 'jt/partial-clone-submodule-1'</title>
<updated>2021-07-17T00:42:53Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-07-17T00:42:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8721e2eaedd0290ef399f638912a49b36402e715'/>
<id>urn:sha1:8721e2eaedd0290ef399f638912a49b36402e715</id>
<content type='text'>
Prepare the internals for lazily fetching objects in submodules
from their promisor remotes.

* jt/partial-clone-submodule-1:
  promisor-remote: teach lazy-fetch in any repo
  run-command: refactor subprocess env preparation
  submodule: refrain from filtering GIT_CONFIG_COUNT
  promisor-remote: support per-repository config
  repository: move global r_f_p_c to repo struct
</content>
</entry>
<entry>
<title>oidtree: a crit-bit tree for odb_loose_cache</title>
<updated>2021-07-08T04:28:04Z</updated>
<author>
<name>Eric Wong</name>
<email>e@80x24.org</email>
</author>
<published>2021-07-07T23:10:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=92d8ed8ac101d62183d51f280b90efb1de1bda5c'/>
<id>urn:sha1:92d8ed8ac101d62183d51f280b90efb1de1bda5c</id>
<content type='text'>
This saves 8K per `struct object_directory', meaning it saves
around 800MB in my case involving 100K alternates (half or more
of those alternates are unlikely to hold loose objects).

This is implemented in two parts: a generic, allocation-free
`cbtree' and the `oidtree' wrapper on top of it.  The latter
provides allocation using alloc_state as a memory pool to
improve locality and reduce free(3) overhead.

Unlike oid-array, the crit-bit tree does not require sorting.
Performance is bound by the key length, for oidtree that is
fixed at sizeof(struct object_id).  There's no need to have
256 oidtrees to mitigate the O(n log n) overhead like we did
with oid-array.

Being a prefix trie, it is natively suited for expanding short
object IDs via prefix-limited iteration in
`find_short_object_filename'.

On my busy workstation, p4205 performance seems to be roughly
unchanged (+/-8%).  Startup with 100K total alternates with no
loose objects seems around 10-20% faster on a hot cache.
(800MB in memory savings means more memory for the kernel FS
cache).

The generic cbtree implementation does impose some extra
overhead for oidtree in that it uses memcmp(3) on
"struct object_id" so it wastes cycles comparing 12 extra bytes
on SHA-1 repositories.  I've not yet explored reducing this
overhead, but I expect there are many places in our code base
where we'd want to investigate this.

More information on crit-bit trees: https://cr.yp.to/critbit.html

Signed-off-by: Eric Wong &lt;e@80x24.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>make object_directory.loose_objects_subdir_seen a bitmap</title>
<updated>2021-07-08T04:27:58Z</updated>
<author>
<name>Eric Wong</name>
<email>e@80x24.org</email>
</author>
<published>2021-07-07T23:10:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=33f379eee63a0529f85079857598ac6325d3aec5'/>
<id>urn:sha1:33f379eee63a0529f85079857598ac6325d3aec5</id>
<content type='text'>
There's no point in using 8 bits per-directory when 1 bit
will do.  This saves us 224 bytes per object directory, which
ends up being 22MB when dealing with 100K alternates.

Signed-off-by: Eric Wong &lt;e@80x24.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>avoid strlen via strbuf_addstr in link_alt_odb_entry</title>
<updated>2021-07-08T04:27:56Z</updated>
<author>
<name>Eric Wong</name>
<email>e@80x24.org</email>
</author>
<published>2021-07-07T23:10:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=407532f82d3fdfd18d4ec276ddeb359e7c724aa6'/>
<id>urn:sha1:407532f82d3fdfd18d4ec276ddeb359e7c724aa6</id>
<content type='text'>
We can save a few milliseconds (across 100K odbs) by using
strbuf_addbuf() instead of strbuf_addstr() by passing `entry' as
a strbuf pointer rather than a "const char *".

Signed-off-by: Eric Wong &lt;e@80x24.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>speed up alt_odb_usable() with many alternates</title>
<updated>2021-07-08T00:21:12Z</updated>
<author>
<name>Eric Wong</name>
<email>e@80x24.org</email>
</author>
<published>2021-07-07T23:10:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cf2dc1c238c6fd5f93c315a3045ccf95459701cd'/>
<id>urn:sha1:cf2dc1c238c6fd5f93c315a3045ccf95459701cd</id>
<content type='text'>
With many alternates, the duplicate check in alt_odb_usable()
wastes many cycles doing repeated fspathcmp() on every existing
alternate.  Use a khash to speed up lookups by odb-&gt;path.

Since the kh_put_* API uses the supplied key without
duplicating it, we also take advantage of it to replace both
xstrdup() and strbuf_release() in link_alt_odb_entry() with
strbuf_detach() to avoid the allocation and copy.

In a test repository with 50K alternates and each of those 50K
alternates having one alternate each (for a total of 100K total
alternates); this speeds up lookup of a non-existent blob from
over 16 minutes to roughly 2.7 seconds on my busy workstation.

Note: all underlying git object directories were small and
unpacked with only loose objects and no packs.  Having to load
packs increases times significantly.

Signed-off-by: Eric Wong &lt;e@80x24.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xmmap: inform Linux users of tuning knobs on ENOMEM</title>
<updated>2021-06-30T06:14:25Z</updated>
<author>
<name>Eric Wong</name>
<email>e@80x24.org</email>
</author>
<published>2021-06-30T00:01:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dc0592941138df684770bfe800ccad6b810214c3'/>
<id>urn:sha1:dc0592941138df684770bfe800ccad6b810214c3</id>
<content type='text'>
Linux users may benefit from additional information on how to
avoid ENOMEM from mmap despite the system having enough RAM to
accomodate them.  We can't reliably unmap pack windows to work
around the issue since malloc and other library routines may
mmap without our knowledge.

Signed-off-by: Eric Wong &lt;e@80x24.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>promisor-remote: teach lazy-fetch in any repo</title>
<updated>2021-06-28T16:58:01Z</updated>
<author>
<name>Jonathan Tan</name>
<email>jonathantanmy@google.com</email>
</author>
<published>2021-06-17T17:13:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ef830cc4341260ef45ffe6c7164e23505d45a5a2'/>
<id>urn:sha1:ef830cc4341260ef45ffe6c7164e23505d45a5a2</id>
<content type='text'>
This is one step towards supporting partial clone submodules.

Even after this patch, we will still lack partial clone submodules
support, primarily because a lot of Git code that accesses submodule
objects does so by adding their object stores as alternates, meaning
that any lazy fetches that would occur in the submodule would be done
based on the config of the superproject, not of the submodule. This also
prevents testing of the functionality in this patch by user-facing
commands. So for now, test this mechanism using a test helper.

Besides that, there is some code that uses the wrapper functions
like has_promisor_remote(). Those will need to be checked to see if they
could support the non-wrapper functions instead (and thus support any
repository, not just the_repository).

Signed-off-by: Jonathan Tan &lt;jonathantanmy@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Reviewed-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
