Commit 005f3fb
builtin/receive-pack: avoid spinning no-op sideband async threads
Exit early if the hooks do not exist, to avoid spinning up/down
sideband async threads which no-op.
It is important to call the hook_exists() API provided by hook.[ch]
because it covers both config-defined hooks and the "traditional"
hooks from the hookdir. find_hook() only covers the hookdir hooks.
The regression happened because the no-op async threads add some
additional overhead which can be measured with the receive-refs test
of the benchmarks suite [1].
Reproduced using:
cd benchmarks/receive-refs && \
./run --revisions /path/to/git \
fc148b1~,fc148b146ad41be71a7852c4867f0773cbfe1ff9 \
--parameter-list refformat reftable --parameter-list refcount 10000
1: https://gitlab.com/gitlab-org/data-access/git/benchmarks
Fixes: fc148b1 ("receive-pack: convert update hooks to new API")
Reported-by: Patrick Steinhardt <ps@pks.im>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
[jc: avoid duplicated hardcoded hook names]
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent b5e9ad5 commit 005f3fb
1 file changed
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
914 | 914 | | |
915 | 915 | | |
916 | 916 | | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
917 | 920 | | |
918 | 921 | | |
919 | 922 | | |
| |||
955 | 958 | | |
956 | 959 | | |
957 | 960 | | |
| 961 | + | |
958 | 962 | | |
959 | 963 | | |
960 | 964 | | |
961 | 965 | | |
962 | 966 | | |
963 | 967 | | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
964 | 971 | | |
965 | 972 | | |
966 | 973 | | |
| |||
969 | 976 | | |
970 | 977 | | |
971 | 978 | | |
972 | | - | |
| 979 | + | |
973 | 980 | | |
974 | 981 | | |
975 | 982 | | |
| |||
1649 | 1656 | | |
1650 | 1657 | | |
1651 | 1658 | | |
| 1659 | + | |
1652 | 1660 | | |
1653 | 1661 | | |
1654 | 1662 | | |
1655 | 1663 | | |
1656 | 1664 | | |
1657 | 1665 | | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
1658 | 1669 | | |
1659 | 1670 | | |
1660 | 1671 | | |
| |||
1665 | 1676 | | |
1666 | 1677 | | |
1667 | 1678 | | |
1668 | | - | |
| 1679 | + | |
1669 | 1680 | | |
1670 | 1681 | | |
1671 | 1682 | | |
| |||
0 commit comments