diff options
author | Jeff King <peff@peff.net> | 2016-05-18 12:56:14 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-05-18 14:17:39 -0700 |
commit | 6a36e1e7bb64726cc712259aff57179d81361b5d (patch) | |
tree | dde1800135b1482f081ad144471d80e6a67cd654 /t/t9802-git-p4-filetype.sh | |
parent | cat-file: avoid noop calls to sha1_object_info_extended (diff) | |
download | tgif-6a36e1e7bb64726cc712259aff57179d81361b5d.tar.xz |
cat-file: default to --buffer when --batch-all-objects is used
Traditionally cat-file's batch-mode does not do any output
buffering. The reason is that a caller may have pipes
connected to its input and output, and would want to use
cat-file interactively, getting output immediately for each
input it sends.
This may involve a lot of small write() calls, which can be
slow. So we introduced --buffer to improve this, but we
can't turn it on by default, as it would break the
interactive case above.
However, when --batch-all-objects is used, we do not read
stdin at all. We generate the output ourselves as quickly as
possible, and then exit. In this case buffering is a strict
win, and it is simply a hassle for the user to have to
remember to specify --buffer.
This patch makes --buffer the default when --batch-all-objects
is used. Specifying "--buffer" manually is still OK, and you
can even override it with "--no-buffer" if you're a
masochist (or debugging).
For some real numbers, running:
git cat-file --batch-all-objects --batch-check='%(objectname)'
on torvalds/linux goes from:
real 0m1.464s
user 0m1.208s
sys 0m0.252s
to:
real 0m1.230s
user 0m1.172s
sys 0m0.056s
for a 16% speedup.
Suggested-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9802-git-p4-filetype.sh')
0 files changed, 0 insertions, 0 deletions