path: root/object.h
diff options
authorLinus Torvalds <>2005-09-16 21:55:33 (GMT)
committerJunio C Hamano <>2005-09-16 22:32:23 (GMT)
commit8805ccac40348094d26b3b892c6ca3d08dc12ae0 (patch)
treeb4465f53abbb399d7491f5b0060d9b5076f52794 /object.h
parentb0d8923ec01fd91b75ab079034f89ced91500157 (diff)
[PATCH] Avoid building object ref lists when not needed
The object parsing code builds a generic "this object references that object" because doing a full connectivity check for fsck requires it. However, nothing else really needs it, and it's quite expensive for git-rev-list that can have tons of objects in flight. So, exactly like the commit buffer save thing, add a global flag to disable it, and use it in git-rev-list. Before: $ /usr/bin/time git-rev-list --objects v2.6.12..HEAD | wc -l 12.28user 0.29system 0:12.57elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+26718minor)pagefaults 0swaps 59124 After this change: $ /usr/bin/time git-rev-list --objects v2.6.12..HEAD | wc -l 10.33user 0.18system 0:10.54elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+18509minor)pagefaults 0swaps 59124 and note how the number of pages touched by git-rev-list for this particular object list has shrunk from 26,718 (104 MB) to 18,509 (72 MB). Calculating the total object difference between two git revisions is still clearly the most expensive git operation (both in memory and CPU time), but it's now less than 40% of what it used to be. Signed-off-by: Linus Torvalds <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'object.h')
1 files changed, 1 insertions, 0 deletions
diff --git a/object.h b/object.h
index bf74449..6accda3 100644
--- a/object.h
+++ b/object.h
@@ -17,6 +17,7 @@ struct object {
void *util;
+extern int track_object_refs;
extern int nr_objs;
extern struct object **objs;