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 (cjhaga@fys.uio.no) Acked-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
committed by
Junio C Hamano
parent
8fced61cbc
commit
12f6c308d5
2
diff.c
2
diff.c
@ -583,7 +583,7 @@ static unsigned char *deflate_it(char *data,
|
||||
z_stream stream;
|
||||
|
||||
memset(&stream, 0, sizeof(stream));
|
||||
deflateInit(&stream, Z_BEST_COMPRESSION);
|
||||
deflateInit(&stream, zlib_compression_level);
|
||||
bound = deflateBound(&stream, size);
|
||||
deflated = xmalloc(bound);
|
||||
stream.next_out = deflated;
|
||||
|
||||
Reference in New Issue
Block a user