Skip to content

Commit 58d1449

Browse files
committed
t5551: pack refs after creating many tags
We have two tests that create 2,000 and 100,000 tags respectively. After doing so, the resulting state can be a bit slow to work with when using the "files" ref backend, as each of those refs is in its own file. This isn't a very realistic scenario, as we'd expect most of those refs to be packed. If they accrue over time along with objects, they'd get packed by maintenance/gc runs. And if you have a process that creates a ton of refs at once (like a big fast-import), the usual recommendation is to run maintenance afterwards. So let's follow that recommendation and pack the refs ourselves. Unfortunately, this does not seem to produce an improvement to the run-time of the test script! That's because after producing this state, we perform only a few fetches of it. And packing the refs costs at least as much as serving a ref advertisement (both have to iterate the refs, but packing additionally must write .lock files as we pack). My wall-clock time was slightly improved (but within the noise) with this patch, but my user and system CPU time were slightly worse! However, on a loaded system with I/O bottlenecks, it may be a net win. That's somewhat of a guess, though. It would be nice if we had a way to generate all of these refs without writing so many individual files. But even if we taught the ref code to write large cases directly to the packed-refs file, we'd still need to take individual locks. The real solution is a backend like reftable, which shaves ~30% off of the test runtime. Signed-off-by: Jeff King <peff@peff.net>
1 parent 51cb5bd commit 58d1449

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

t/t5551-http-fetch-smart.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ create_tags () {
393393
tag=$(perl -e "print \"bla\" x 30") &&
394394
sed -e "s|^:\([^ ]*\) \(.*\)$|create refs/tags/$tag-\1 \2|" <marks >input &&
395395
git update-ref --stdin <input &&
396+
git pack-refs --all &&
396397
rm input
397398
}
398399

0 commit comments

Comments
 (0)