]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Default core.packdGitWindowSize to 1 MiB if NO_MMAP.
authorShawn O. Pearce <spearce@spearce.org>
Sun, 24 Dec 2006 05:46:13 +0000 (00:46 -0500)
committerJunio C Hamano <junkio@cox.net>
Fri, 29 Dec 2006 19:36:45 +0000 (11:36 -0800)
If the compiler has asked us to disable use of mmap() on their
platform then we are forced to use git_mmap and its emulation via
pread.  In this case large (e.g. 32 MiB) windows for pack access
are simply too big as a command will wind up reading a lot more
data than it will ever need, significantly reducing response time.

To prevent a high latency when NO_MMAP has been selected we now
use a default of 1 MiB for core.packedGitWindowSize.  Credit goes
to Linus and Junio for recommending this more reasonable setting.

[jc: upcased the name of the symbolic constant, and made another
 hardcoded constant into a symbolic constant while at it. ]

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
environment.c
git-compat-util.h

index e559fd69c7e4825e92c9540c78b0cf4de43467f3..09976c7bf63a2a1f77854f8157d430c00c0e3473 100644 (file)
@@ -23,8 +23,8 @@ char *git_log_output_encoding;
 int shared_repository = PERM_UMASK;
 const char *apply_default_whitespace;
 int zlib_compression_level = Z_DEFAULT_COMPRESSION;
-size_t packed_git_window_size = 32 * 1024 * 1024;
-size_t packed_git_limit = 256 * 1024 * 1024;
+size_t packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE;
+size_t packed_git_limit = DEFAULT_PACKED_GIT_LIMIT;
 int pager_in_use;
 int pager_use_color = 1;
 
index 5d9eb2615b2e21979f547199121828aafbf02135..4764087d8550afa781430461d3fffc3e1bcf1da8 100644 (file)
@@ -92,12 +92,17 @@ extern void set_warn_routine(void (*routine)(const char *warn, va_list params));
 extern void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset);
 extern int git_munmap(void *start, size_t length);
 
+#define DEFAULT_PACKED_GIT_WINDOW_SIZE (1 * 1024 * 1024)
+
 #else /* NO_MMAP */
 
 #include <sys/mman.h>
+#define DEFAULT_PACKED_GIT_WINDOW_SIZE (32 * 1024 * 1024)
 
 #endif /* NO_MMAP */
 
+#define DEFAULT_PACKED_GIT_LIMIT (256 * 1024 * 1024)
+
 #ifdef NO_SETENV
 #define setenv gitsetenv
 extern int gitsetenv(const char *, const char *, int);