@matheusbsbs / matheus-bagliano / commits / 8c82534d89
Fork 0

Default core.packdGitWindowSize to 1 MiB if NO_MMAP.

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>

Shawn O. Pearce committed Dec 24, 2006 at 00:46 UTC 8c82534d89cef9260c12768e74eb4ef6c54f7217
2 files changed +7 -2
environment.c
+2 -2
@@ -23,8 +23,8 @@ char *git_log_output_encoding;
23 int shared_repository = PERM_UMASK;
24 const char *apply_default_whitespace;
25 int zlib_compression_level = Z_DEFAULT_COMPRESSION;
26 -size_t packed_git_window_size = 32 * 1024 * 1024;
27 -size_t packed_git_limit = 256 * 1024 * 1024;
26 +size_t packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE;
27 +size_t packed_git_limit = DEFAULT_PACKED_GIT_LIMIT;
28 int pager_in_use;
29 int pager_use_color = 1;
30
git-compat-util.h
+5
@@ -92,12 +92,17 @@ extern void set_warn_routine(void (*routine)(const char *warn, va_list params));
92 extern void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset);
93 extern int git_munmap(void *start, size_t length);
94
95 +#define DEFAULT_PACKED_GIT_WINDOW_SIZE (1 * 1024 * 1024)
96 +
97 #else /* NO_MMAP */
98
99 #include <sys/mman.h>
100 +#define DEFAULT_PACKED_GIT_WINDOW_SIZE (32 * 1024 * 1024)
101
102 #endif /* NO_MMAP */
103
104 +#define DEFAULT_PACKED_GIT_LIMIT (256 * 1024 * 1024)
105 +
106 #ifdef NO_SETENV
107 #define setenv gitsetenv
108 extern int gitsetenv(const char *, const char *, int);