diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2021-09-01 14:54:42 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-09-01 10:20:39 -0700 |
commit | 70afef5cdf29b5159f18df1b93722055f78740f8 (patch) | |
tree | 596bb4193b09a26e91d2450a77cbf00e87a59497 /parse-options-cb.c | |
parent | pkt-line: add stdio packet write functions (diff) | |
download | tgif-70afef5cdf29b5159f18df1b93722055f78740f8.tar.xz |
upload-pack: use stdio in send_ref callbacks
In both protocol v0 and v2, upload-pack writes one pktline packet per
advertised ref to stdout. That means one or two write(2) syscalls per
ref. This is problematic if these writes become network sends with
high overhead.
This commit changes both send_ref callbacks to use buffered IO using
stdio.
To give an example of the impact: I set up a single-threaded loop that
calls ls-remote (with HTTP and protocol v2) on a local GitLab
instance, on a repository with 11K refs. When I switch from Git
v2.32.0 to this patch, I see a 40% reduction in CPU time for Git, and
65% for Gitaly (GitLab's Git RPC service).
So using buffered IO not only saves syscalls in upload-pack, it also
saves time in things that consume upload-pack's output.
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Jacob Vosmaer <jacob@gitlab.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options-cb.c')
0 files changed, 0 insertions, 0 deletions