From 12f6c308d53509dcb11e309604457d21d60438db Mon Sep 17 00:00:00 2001 From: Joachim B Haga Date: Mon, 3 Jul 2006 22:11:47 +0200 Subject: 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 Signed-off-by: Junio C Hamano --- config.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'config.c') diff --git a/config.c b/config.c index ec44827da4..b23f4bf487 100644 --- a/config.c +++ b/config.c @@ -279,6 +279,16 @@ int git_default_config(const char *var, const char *value) return 0; } + if (!strcmp(var, "core.compression")) { + int level = git_config_int(var, value); + if (level == -1) + level = Z_DEFAULT_COMPRESSION; + else if (level < 0 || level > Z_BEST_COMPRESSION) + die("bad zlib compression level %d", level); + zlib_compression_level = level; + return 0; + } + if (!strcmp(var, "user.name")) { strlcpy(git_default_name, value, sizeof(git_default_name)); return 0; -- cgit v1.2.3