summaryrefslogtreecommitdiff
path: root/src/pack.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2012-12-19 16:48:12 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2013-01-11 16:55:37 +0100
commitc0f4a0118dd3821447512bf3b404be69c773eaf8 (patch)
treeadf6969a0fc3565a5409ef9593eecf338bb56059 /src/pack.h
parent2086e1baef456da0e9dbb1d433079618083b1b95 (diff)
downloadlibgit2-c0f4a0118dd3821447512bf3b404be69c773eaf8.tar.gz
pack: introduce a delta base cache
Many delta bases are re-used. Cache them to avoid inflating the same data repeatedly. This version doesn't limit the amount of entries to store, so it can end up using a considerable amound of memory.
Diffstat (limited to 'src/pack.h')
-rw-r--r--src/pack.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pack.h b/src/pack.h
index bbfcca591..0f795f6f4 100644
--- a/src/pack.h
+++ b/src/pack.h
@@ -53,6 +53,15 @@ struct git_pack_idx_header {
uint32_t idx_version;
};
+typedef struct git_pack_cache_entry {
+ git_off_t off;
+ git_rawobj raw;
+} git_pack_cache_entry;
+
+#include "offmap.h"
+
+GIT__USE_OFFMAP;
+
struct git_pack_file {
git_mwindow_file mwf;
git_map index_map;
@@ -68,6 +77,8 @@ struct git_pack_file {
git_vector cache;
git_oid **oids;
+ git_offmap *bases; /* delta base cache */
+
/* something like ".git/objects/pack/xxxxx.pack" */
char pack_name[GIT_FLEX_ARRAY]; /* more */
};