summaryrefslogtreecommitdiff
path: root/commit.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2013-04-09 06:52:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-04-14 04:50:54 (GMT)
commit96c4f4a370591b4796628abe18f27f0133b21954 (patch)
tree4964fb0b626a4cbc0c451d99b9cf1f862d225a7f /commit.h
parenta46221e9adcf3deb88c4fc904859205bf87f784c (diff)
downloadgit-96c4f4a370591b4796628abe18f27f0133b21954.zip
git-96c4f4a370591b4796628abe18f27f0133b21954.tar.gz
git-96c4f4a370591b4796628abe18f27f0133b21954.tar.bz2
commit: allow associating auxiliary info on-demand
The "indegree" field in the commit object is only used while sorting a list of commits in topological order, and wasting memory otherwise. We would prefer to shrink the size of individual commit objects, which we may have to hold thousands of in-core. We could eject "indegree" field out from the commit object and represent it as a dynamic table based on the decoration infrastructure, but the decoration is meant for sparse annotation and is not a good match. Instead, let's try a different approach. - Assign an integer (commit->index) to each commit we keep in-core (reuse the space of "indegree" field for it); - When running the topological sort, allocate an array of integers in bulk (called "slab"), use the commit->index as an index into this array, and store the "indegree" information there. This does _not_ reduce the memory footprint of a commit object, but the commit->index can be used as the index to dynamically associate commits with other kinds of information as needed. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.h')
-rw-r--r--commit.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/commit.h b/commit.h
index 252c7f8..70e749d 100644
--- a/commit.h
+++ b/commit.h
@@ -14,7 +14,7 @@ struct commit_list {
struct commit {
struct object object;
void *util;
- unsigned int indegree;
+ unsigned int index;
unsigned long date;
struct commit_list *parents;
struct tree *tree;