summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2006-12-23 07:34:28 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-12-29 19:36:45 (GMT)
commit60bb8b1453e2f93d13e7bb44e8e46c085d2dd752 (patch)
tree3203b1cd4a7479e0175a4c65462ea714ccdabd9b /config.c
parent54044bf825d311751e30552248be1e0cac99a5a3 (diff)
downloadgit-60bb8b1453e2f93d13e7bb44e8e46c085d2dd752.zip
git-60bb8b1453e2f93d13e7bb44e8e46c085d2dd752.tar.gz
git-60bb8b1453e2f93d13e7bb44e8e46c085d2dd752.tar.bz2
Fully activate the sliding window pack access.
This finally turns on the sliding window behavior for packfile data access by mapping limited size windows and chaining them under the packed_git->windows list. We consider a given byte offset to be within the window only if there would be at least 20 bytes (one hash worth of data) accessible after the requested offset. This range selection relates to the contract that use_pack() makes with its callers, allowing them to access one hash or one object header without needing to call use_pack() for every byte of data obtained. In the worst case scenario we will map the same page of data twice into memory: once at the end of one window and once again at the start of the next window. This duplicate page mapping will happen only when an object header or a delta base reference is spanned over the end of a window and is always limited to just one page of duplication, as no sane operating system will ever have a page size smaller than a hash. I am assuming that the possible wasted page of virtual address space is going to perform faster than the alternatives, which would be to copy the object header or ref delta into a temporary buffer prior to parsing, or to check the window range on every byte during header parsing. We may decide to revisit this decision in the future since this is just a gut instinct decision and has not actually been proven out by experimental testing. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'config.c')
-rw-r--r--config.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/config.c b/config.c
index 0c21286..21f166e 100644
--- a/config.c
+++ b/config.c
@@ -298,6 +298,16 @@ int git_default_config(const char *var, const char *value)
return 0;
}
+ if (!strcmp(var, "core.packedgitwindowsize")) {
+ int pgsz = getpagesize();
+ packed_git_window_size = git_config_int(var, value);
+ packed_git_window_size /= pgsz;
+ if (!packed_git_window_size)
+ packed_git_window_size = 1;
+ packed_git_window_size *= pgsz;
+ return 0;
+ }
+
if (!strcmp(var, "core.packedgitlimit")) {
packed_git_limit = git_config_int(var, value);
return 0;