git/t/perf/p5313-pack-objects.sh
Derrick Stolee ed9d28ab7d pack-objects: thread the path-based compression
Adapting the implementation of ll_find_deltas(), create a threaded
version of the --path-walk compression step in 'git pack-objects'.

This involves adding a 'regions' member to the thread_params struct,
allowing each thread to own a section of paths. We can simplify the way
jobs are split because there is no value in extending the batch based on
name-hash the way sections of the object entry array are attempted to be
grouped. We re-use the 'list_size' and 'remaining' items for the purpose
of borrowing work in progress from other "victim" threads when a thread
has finished its batch of work more quickly.

Using the Git repository as a test repo, the p5313 performance test
shows that the resulting size of the repo is the same, but the threaded
implementation gives gains of varying degrees depending on the number of
objects being packed. (This was tested on a 16-core machine.)

Test                                    HEAD~1    HEAD
-------------------------------------------------------------
5313.6: thin pack with --path-walk        0.01    0.01  +0.0%
5313.7: thin pack size with --path-walk    475     475  +0.0%
5313.12: big pack with --path-walk        1.99    1.87  -6.0%
5313.13: big pack size with --path-walk  14.4M   14.3M  -0.4%
5313.18: repack with --path-walk         98.14   41.46 -57.8%
5313.19: repack size with --path-walk   197.2M  197.3M  +0.0%

Signed-off-by: Derrick Stolee <stolee@gmail.com>
2025-02-26 21:14:42 +01:00

96 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
test_description='Tests pack performance using bitmaps'
. ./perf-lib.sh
GIT_TEST_PASSING_SANITIZE_LEAK=0
export GIT_TEST_PASSING_SANITIZE_LEAK
test_perf_large_repo
test_expect_success 'create rev input' '
cat >in-thin <<-EOF &&
$(git rev-parse HEAD)
^$(git rev-parse HEAD~1)
EOF
cat >in-big <<-EOF &&
$(git rev-parse HEAD)
^$(git rev-parse HEAD~1000)
EOF
cat >in-shallow <<-EOF
$(git rev-parse HEAD)
--shallow $(git rev-parse HEAD)
EOF
'
for version in 1 2
do
export version
test_perf "thin pack with version $version" '
git pack-objects --thin --stdout --revs --sparse \
--name-hash-version=$version <in-thin >out
'
test_size "thin pack size with version $version" '
test_file_size out
'
test_perf "big pack with version $version" '
git pack-objects --stdout --revs --sparse \
--name-hash-version=$version <in-big >out
'
test_size "big pack size with version $version" '
test_file_size out
'
test_perf "shallow fetch pack with version $version" '
git pack-objects --stdout --revs --sparse --shallow \
--name-hash-version=$version <in-shallow >out
'
test_size "shallow pack size with version $version" '
test_file_size out
'
test_perf "repack with version $version" '
git repack -adf --name-hash-version=$version
'
test_size "repack size with version $version" '
gitdir=$(git rev-parse --git-dir) &&
pack=$(ls $gitdir/objects/pack/pack-*.pack) &&
test_file_size "$pack"
'
done
test_perf 'thin pack with --path-walk' '
git pack-objects --thin --stdout --revs --sparse --path-walk <in-thin >out
'
test_size 'thin pack size with --path-walk' '
test_file_size out
'
test_perf 'big pack with --path-walk' '
git pack-objects --stdout --revs --sparse --path-walk <in-big >out
'
test_size 'big pack size with --path-walk' '
test_file_size out
'
test_perf 'repack with --path-walk' '
git repack -adf --path-walk
'
test_size 'repack size with --path-walk' '
pack=$(ls .git/objects/pack/pack-*.pack) &&
test_file_size "$pack"
'
test_done