mirror of
https://github.com/git/git.git
synced 2026-05-25 11:25:06 +02:00
Merge branch 'sb/unpack-index-pack-buffer-resize'
Use a larger buffer size in the code paths to ingest pack stream. * sb/unpack-index-pack-buffer-resize: index-pack, unpack-objects: increase input buffer from 4 KiB to 128 KiB
This commit is contained in:
@@ -145,8 +145,7 @@ static int check_self_contained_and_connected;
|
||||
|
||||
static struct progress *progress;
|
||||
|
||||
/* We always read in 4kB chunks. */
|
||||
static unsigned char input_buffer[4096];
|
||||
static unsigned char input_buffer[DEFAULT_IO_BUFFER_SIZE];
|
||||
static unsigned int input_offset, input_len;
|
||||
static off_t consumed_bytes;
|
||||
static off_t max_input_size;
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
static int dry_run, quiet, recover, has_errors, strict;
|
||||
static const char unpack_usage[] = "git unpack-objects [-n] [-q] [-r] [--strict]";
|
||||
|
||||
/* We always read in 4kB chunks. */
|
||||
static unsigned char buffer[4096];
|
||||
static unsigned char buffer[DEFAULT_IO_BUFFER_SIZE];
|
||||
static unsigned int offset, len;
|
||||
static off_t consumed_bytes;
|
||||
static off_t max_input_size;
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@ struct hashfile *hashfd_ext(const struct git_hash_algo *algop,
|
||||
f->algop = unsafe_hash_algo(algop);
|
||||
f->algop->init_fn(&f->ctx);
|
||||
|
||||
f->buffer_len = opts->buffer_len ? opts->buffer_len : 128 * 1024;
|
||||
f->buffer_len = opts->buffer_len ? opts->buffer_len : DEFAULT_IO_BUFFER_SIZE;
|
||||
f->buffer = xmalloc(f->buffer_len);
|
||||
f->check_buffer = NULL;
|
||||
|
||||
|
||||
@@ -712,6 +712,12 @@ static inline uint64_t u64_add(uint64_t a, uint64_t b)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Default buffer size for buffered I/O in index-pack, unpack-objects,
|
||||
* and the hashfile layer in csum-file.
|
||||
*/
|
||||
#define DEFAULT_IO_BUFFER_SIZE (128 * 1024)
|
||||
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
# define xalloca(size) (alloca(size))
|
||||
|
||||
Reference in New Issue
Block a user