summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8fced61)
raw | patch | inline | side by side (parent: 8fced61)
author | Joachim B Haga <cjhaga@fys.uio.no> | |
Mon, 3 Jul 2006 20:11:47 +0000 (22:11 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 3 Jul 2006 20:55:11 +0000 (13:55 -0700) |
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>
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>
Documentation/config.txt | patch | blob | history | |
cache.h | patch | blob | history | |
config.c | patch | blob | history | |
csum-file.c | patch | blob | history | |
diff.c | patch | blob | history | |
environment.c | patch | blob | history | |
http-push.c | patch | blob | history | |
sha1_file.c | patch | blob | history |
index a04c5adf8e522e65fae58ec32db07c46aeebe070..16bdd55233f2f1a11a80f60dfa85b84145c836f6 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
If true, git will warn you if the ref name you passed it is ambiguous
and might match multiple refs in the .git/refs/ tree. True by default.
+core.compression:
+ An integer -1..9, indicating the compression level for objects that
+ are not in a pack file. -1 is the zlib and git default. 0 means no
+ compression, and 1..9 are various speed/size tradeoffs, 9 being
+ slowest.
+
alias.*::
Command aliases for the gitlink:git[1] command wrapper - e.g.
after defining "alias.last = cat-file commit HEAD", the invocation
index 87199396a05fbbbb695379119535eb9eefae2514..84770bf67a9e73d1654d94a2e558bbe026d20532 100644 (file)
--- a/cache.h
+++ b/cache.h
extern int warn_ambiguous_refs;
extern int shared_repository;
extern const char *apply_default_whitespace;
+extern int zlib_compression_level;
#define GIT_REPO_VERSION 0
extern int repository_format_version;
diff --git a/config.c b/config.c
index ec44827da4afbcf89a5eed37c7f557a7ffdce35d..b23f4bf487f5f4350f46e13c590db6f7ea1f5917 100644 (file)
--- a/config.c
+++ b/config.c
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;
diff --git a/csum-file.c b/csum-file.c
index ebaad0397f0bce50db7542abb904ba42b6173344..6a7b40fd09ea9aa365d70dc8019f83e481192c07 100644 (file)
--- a/csum-file.c
+++ b/csum-file.c
void *out;
memset(&stream, 0, sizeof(stream));
- deflateInit(&stream, Z_DEFAULT_COMPRESSION);
+ deflateInit(&stream, zlib_compression_level);
maxsize = deflateBound(&stream, size);
out = xmalloc(maxsize);
index 5a71489a471568fb3aa51af5d74fa269ec4fadf1..428ff786ebdbd48a47ae5faf4c65c01e38403ad4 100644 (file)
--- a/diff.c
+++ b/diff.c
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;
diff --git a/environment.c b/environment.c
index 3de8eb3b2a2359a9f8a9f702076292f1e1429df3..43823ff7d650a95dbb06e74397bdc5b7e5c00528 100644 (file)
--- a/environment.c
+++ b/environment.c
char git_commit_encoding[MAX_ENCODING_LENGTH] = "utf-8";
int shared_repository = PERM_UMASK;
const char *apply_default_whitespace = NULL;
+int zlib_compression_level = Z_DEFAULT_COMPRESSION;
static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
*git_graft_file;
diff --git a/http-push.c b/http-push.c
index e281f70e544d1e59c47f61ce14a728ba5ef44a44..f761584d7edf25147b731405c2996478c7177935 100644 (file)
--- a/http-push.c
+++ b/http-push.c
/* Set it up */
memset(&stream, 0, sizeof(stream));
- deflateInit(&stream, Z_BEST_COMPRESSION);
+ deflateInit(&stream, zlib_compression_level);
size = deflateBound(&stream, len + hdrlen);
request->buffer.buffer = xmalloc(size);
diff --git a/sha1_file.c b/sha1_file.c
index 817963045b81cef36bf3a9c76b7399a70226a181..bc3580844023c9ae0f833ea5799c05887e1d88aa 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1458,7 +1458,7 @@ int write_sha1_file(void *buf, unsigned long len, const char *type, unsigned cha
/* Set it up */
memset(&stream, 0, sizeof(stream));
- deflateInit(&stream, Z_BEST_COMPRESSION);
+ deflateInit(&stream, zlib_compression_level);
size = deflateBound(&stream, len+hdrlen);
compressed = xmalloc(size);
/* Set it up */
memset(&stream, 0, sizeof(stream));
- deflateInit(&stream, Z_BEST_COMPRESSION);
+ deflateInit(&stream, zlib_compression_level);
size = deflateBound(&stream, len + hdrlen);
buf = xmalloc(size);