summaryrefslogtreecommitdiff
path: root/builtin/update-server-info.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-08-10 23:15:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-08-13 20:48:28 (GMT)
commit736eb88fdc8a2dea4302114d2f74b580d0f83cfe (patch)
treeed4c46277358f31725d28a9dd983d3d4afbd9257 /builtin/update-server-info.c
parent8b361551900be9bedd946386362f2d0e2a506845 (diff)
downloadgit-736eb88fdc8a2dea4302114d2f74b580d0f83cfe.zip
git-736eb88fdc8a2dea4302114d2f74b580d0f83cfe.tar.gz
git-736eb88fdc8a2dea4302114d2f74b580d0f83cfe.tar.bz2
for_each_packed_object: support iterating in pack-order
We currently iterate over objects within a pack in .idx order, which uses the object hashes. That means that it is effectively random with respect to the location of the object within the pack. If you're going to access the actual object data, there are two reasons to move linearly through the pack itself: 1. It improves the locality of access in the packfile. In the cold-cache case, this may mean fewer disk seeks, or better usage of disk cache. 2. We store related deltas together in the packfile. Which means that the delta base cache can operate much more efficiently if we visit all of those related deltas in sequence, as the earlier items are likely to still be in the cache. Whereas if we visit the objects in random order, our cache entries are much more likely to have been evicted by unrelated deltas in the meantime. So in general, if you're going to access the object contents pack order is generally going to end up more efficient. But if you're simply generating a list of object names, or if you're going to end up sorting the result anyway, you're better off just using the .idx order, as finding the pack order means generating the in-memory pack-revindex. According to the numbers in 8b8dfd5132 (pack-revindex: radix-sort the revindex, 2013-07-11), that takes about 200ms for linux.git, and 20ms for git.git (those numbers are a few years old but are still a good ballpark). That makes it a good optimization for some cases (we can save tens of seconds in git.git by having good locality of delta access, for a 20ms cost), but a bad one for others (e.g., right now "cat-file --batch-all-objects --batch-check="%(objectname)" is 170ms in git.git, so adding 20ms to that is noticeable). Hence this patch makes it an optional flag. You can't actually do any interesting timings yet, as it's not plumbed through to any user-facing tools like cat-file. That will come in a later patch. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/update-server-info.c')
0 files changed, 0 insertions, 0 deletions