path: root/csum-file.c
diff options
authorJoachim B Haga <>2006-07-03 20:11:47 (GMT)
committerJunio C Hamano <>2006-07-03 20:55:11 (GMT)
commit12f6c308d53509dcb11e309604457d21d60438db (patch)
treec4aa1d1649c4ae179f31cd770da328a82ed37a5c /csum-file.c
parent8fced61cbc32f0c4b81a3dcecfeb40b7d96339ce (diff)
Make zlib compression level configurable, and change default.
With the change in default, "git add ." on kernel dir is about twice as fast as before, with only minimal (0.5%) change in object size. The speed difference is even more noticeable when committing large files, which is now up to 8 times faster. The configurability is through setting core.compression = [-1..9] which maps to the zlib constants; -1 is the default, 0 is no compression, and 1..9 are various speed/size tradeoffs, 9 being slowest. Signed-off-by: Joachim B Haga ( Acked-by: Linus Torvalds <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'csum-file.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/csum-file.c b/csum-file.c
index ebaad03..6a7b40f 100644
--- a/csum-file.c
+++ b/csum-file.c
@@ -122,7 +122,7 @@ int sha1write_compressed(struct sha1file *f, void *in, unsigned int size)
void *out;
memset(&stream, 0, sizeof(stream));
- deflateInit(&stream, Z_DEFAULT_COMPRESSION);
+ deflateInit(&stream, zlib_compression_level);
maxsize = deflateBound(&stream, size);
out = xmalloc(maxsize);