git-commit-vandalism/t/perf/p1400-update-ref.sh
Patrick Steinhardt 21020430a4 p1400: use git-update-ref --stdin to test multiple transactions
In commit 0a0fbbe3ff (refs: remove lookup cache for
reference-transaction hook, 2020-08-25), a new benchmark was added to
p1400 which has the intention to exercise creation of multiple
transactions in a single process. As git-update-ref wasn't yet able to
create multiple transactions with a single run we instead used git-push.
As its non-atomic version creates a transaction per reference update,
this was the best approximation we could make at that point in time.

Now that `git-update-ref --stdin` supports creation of multiple
transactions, let's convert the benchmark to use that instead. It has
less overhead and it's also a lot clearer what the actual intention is.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-11-16 13:44:01 -08:00

34 lines
694 B
Bash
Executable File

#!/bin/sh
test_description="Tests performance of update-ref"
. ./perf-lib.sh
test_perf_fresh_repo
test_expect_success "setup" '
test_commit PRE &&
test_commit POST &&
for i in $(test_seq 5000)
do
printf "start\ncreate refs/heads/%d PRE\ncommit\n" $i &&
printf "start\nupdate refs/heads/%d POST PRE\ncommit\n" $i &&
printf "start\ndelete refs/heads/%d POST\ncommit\n" $i
done >instructions
'
test_perf "update-ref" '
for i in $(test_seq 1000)
do
git update-ref refs/heads/branch PRE &&
git update-ref refs/heads/branch POST PRE &&
git update-ref -d refs/heads/branch
done
'
test_perf "update-ref --stdin" '
git update-ref --stdin <instructions >/dev/null
'
test_done