[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 <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
3 files changed
tree: b4465f53abbb399d7491f5b0060d9b5076f52794
  1. debian/
  2. Documentation/
  3. mozilla-sha1/
  4. ppc/
  5. t/
  6. templates/
  7. .gitignore
  8. apply.c
  9. blob.c
  10. blob.h
  11. cache.h
  12. cat-file.c
  13. checkout-index.c
  14. clone-pack.c
  15. cmd-rename.sh
  16. commit-tree.c
  17. commit.c
  18. commit.h
  19. connect.c
  20. convert-objects.c
  21. COPYING
  22. count-delta.c
  23. count-delta.h
  24. csum-file.c
  25. csum-file.h
  26. daemon.c
  27. date.c
  28. delta.h
  29. diff-delta.c
  30. diff-files.c
  31. diff-helper.c
  32. diff-index.c
  33. diff-stages.c
  34. diff-tree.c
  35. diff.c
  36. diff.h
  37. diffcore-break.c
  38. diffcore-order.c
  39. diffcore-pathspec.c
  40. diffcore-pickaxe.c
  41. diffcore-rename.c
  42. diffcore.h
  43. entry.c
  44. epoch.c
  45. epoch.h
  46. export.c
  47. fetch-pack.c
  48. fetch.c
  49. fetch.h
  50. fsck-objects.c
  51. get-tar-commit-id.c
  52. git-add.sh
  53. git-applymbox.sh
  54. git-applypatch.sh
  55. git-archimport.perl
  56. git-bisect.sh
  57. git-branch.sh
  58. git-checkout.sh
  59. git-cherry.sh
  60. git-clone.sh
  61. git-commit.sh
  62. git-core.spec.in
  63. git-count-objects.sh
  64. git-cvsimport.perl
  65. git-diff.sh
  66. git-external-diff-script
  67. git-fetch.sh
  68. git-format-patch.sh
  69. git-grep.sh
  70. git-log.sh
  71. git-ls-remote.sh
  72. git-merge-octopus.sh
  73. git-merge-one-file.sh
  74. git-merge-recursive.py
  75. git-merge-resolve.sh
  76. git-merge-stupid.sh
  77. git-merge.sh
  78. git-octopus.sh
  79. git-parse-remote.sh
  80. git-prune.sh
  81. git-pull.sh
  82. git-push.sh
  83. git-rebase.sh
  84. git-relink.perl
  85. git-rename.perl
  86. git-repack.sh
  87. git-request-pull.sh
  88. git-reset.sh
  89. git-resolve.sh
  90. git-revert.sh
  91. git-send-email.perl
  92. git-sh-setup.sh
  93. git-shortlog.perl
  94. git-status.sh
  95. git-tag.sh
  96. git-verify-tag.sh
  97. git-whatchanged.sh
  98. git.sh
  99. gitk
  100. gitMergeCommon.py
  101. hash-object.c
  102. http-fetch.c
  103. ident.c
  104. index.c
  105. init-db.c
  106. INSTALL
  107. local-fetch.c
  108. ls-files.c
  109. ls-tree.c
  110. mailinfo.c
  111. mailsplit.c
  112. Makefile
  113. merge-base.c
  114. merge-index.c
  115. mktag.c
  116. object.c
  117. object.h
  118. pack-check.c
  119. pack-objects.c
  120. pack.h
  121. patch-delta.c
  122. patch-id.c
  123. path.c
  124. peek-remote.c
  125. pkt-line.c
  126. pkt-line.h
  127. prune-packed.c
  128. quote.c
  129. quote.h
  130. read-cache.c
  131. read-tree.c
  132. README
  133. receive-pack.c
  134. refs.c
  135. refs.h
  136. rev-list.c
  137. rev-parse.c
  138. rev-tree.c
  139. rsh.c
  140. rsh.h
  141. run-command.c
  142. run-command.h
  143. send-pack.c
  144. server-info.c
  145. setup.c
  146. sha1_file.c
  147. sha1_name.c
  148. show-branch.c
  149. show-index.c
  150. ssh-fetch.c
  151. ssh-pull.c
  152. ssh-push.c
  153. ssh-upload.c
  154. strbuf.c
  155. strbuf.h
  156. stripspace.c
  157. tag.c
  158. tag.h
  159. tar-tree.c
  160. test-date.c
  161. test-delta.c
  162. tree.c
  163. tree.h
  164. unpack-file.c
  165. unpack-objects.c
  166. update-index.c
  167. update-server-info.c
  168. upload-pack.c
  169. usage.c
  170. var.c
  171. verify-pack.c
  172. write-tree.c