summaryrefslogtreecommitdiff
path: root/t/perf/p4000-diff-algorithms.sh
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2016-06-08 15:42:16 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-06-08 16:02:40 -0700
commitf0bca72dc77f62d61fc355bd6fe6e32b194950b8 (patch)
tree589fd55dff9a6068d5785ffd17de2d13110c94fa /t/perf/p4000-diff-algorithms.sh
parentGit 2.8.4 (diff)
downloadtgif-f0bca72dc77f62d61fc355bd6fe6e32b194950b8.tar.xz
send-pack: use buffered I/O to talk to pack-objects
We start a pack-objects process and then write all of the positive and negative sha1s to it over a pipe. We do so by formatting each item into a fixed-size buffer and then writing each individually. This has two drawbacks: 1. There's some manual computation of the buffer size, which is not immediately obvious is correct (though it is). 2. We write() once per sha1, which means a lot more system calls than are necessary. We can solve both by wrapping the pipe descriptor in a stdio handle; this is the same technique used by upload-pack when serving fetches. Note that we can also simplify and improve the error handling here. The original detected a single write error and broke out of the loop (presumably to avoid writing the error message over and over), but never actually acted on seeing an error; we just fed truncated input and took whatever pack-objects returned. In practice, this probably didn't matter, as the likely errors would be caused by pack-objects dying (and we'd probably just die with SIGPIPE anyway). But we can easily make this simpler and more robust; the stdio handle keeps an error flag, which we can check at the end. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/perf/p4000-diff-algorithms.sh')
0 files changed, 0 insertions, 0 deletions