From: Martin Koegler <mkoegler@auto.tuwien.ac.at>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org, Martin Koegler <mkoegler@auto.tuwien.ac.at>
Subject: [PATCH 3/3] builtin-pack-object: cache small deltas
Date: Mon, 28 May 2007 23:20:59 +0200 [thread overview]
Message-ID: <11803872602056-git-send-email-mkoegler@auto.tuwien.ac.at> (raw)
In-Reply-To: <11803872591103-git-send-email-mkoegler@auto.tuwien.ac.at>
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
---
Caching small deltas improves packing time even on small repostistories.
Repacking git.git with a delta size limit of 1000 brings CPU time from
66 to 49 seconds down. A limit of 500 bytes is only two secondes slower.
The implicit cache size limit is (#objects)*(delta size limit).
Documentation/config.txt | 4 ++++
builtin-pack-objects.c | 8 ++++++++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 83cc4cd..0061f7f 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -572,6 +572,10 @@ pack.deltaCacheSize::
gitlink:git-pack-objects[1].
A value of 0 means no limit. Defaults to 0.
+pack.deltaCacheLimit::
+ The maxium size of a delta, that is cached in
+ gitlink:git-pack-objects[1]. Defaults to 1000.
+
pull.octopus::
The default merge strategy to use when pulling multiple branches
at once.
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 85e08dc..c316fea 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -79,6 +79,7 @@ static int pack_compression_seen;
static unsigned long delta_cache_size = 0;
static unsigned long max_delta_cache_size = 0;
+static unsigned long cache_max_small_delta_size = 1000;
/*
* The object names in objects array are hashed with this hashtable,
@@ -1403,6 +1404,9 @@ static int delta_cacheable (struct unpacked *trg, struct unpacked *src,
if (max_delta_cache_size && delta_cache_size + delta_size > max_delta_cache_size)
return 0;
+ if (delta_size < cache_max_small_delta_size)
+ return 1;
+
/* cache delta, if objects are large enough compared to delta size */
if ((src_size >> 20) + (trg_size >> 21) > (delta_size >> 10))
return 1;
@@ -1654,6 +1658,10 @@ static int git_pack_config(const char *k, const char *v)
max_delta_cache_size = git_config_int(k, v);
return 0;
}
+ if(!strcmp(k, "pack.deltacachelimit")) {
+ cache_max_small_delta_size = git_config_int(k, v);
+ return 0;
+ }
return git_default_config(k, v);
}
--
1.5.2.846.g9a144
next prev parent reply other threads:[~2007-05-28 21:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-28 21:20 [PATCH 1/3] builtin-pack-objects: don't fail, if delta is not possible Martin Koegler
2007-05-28 21:20 ` [PATCH 2/3] git-pack-objects: cache small deltas between big objects Martin Koegler
2007-05-28 21:20 ` Martin Koegler [this message]
2007-05-29 0:33 ` [PATCH 3/3] builtin-pack-object: cache small deltas Dana How
2007-05-29 2:45 ` [PATCH 1/3] builtin-pack-objects: don't fail, if delta is not possible Nicolas Pitre
2007-05-29 2:53 ` Shawn O. Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11803872602056-git-send-email-mkoegler@auto.tuwien.ac.at \
--to=mkoegler@auto.tuwien.ac.at \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).