git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Submodule object store

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Mar 27, 2007, 18:41 UTC
Message-ID
<Pine.LNX.4.64.0703271124590.6730@woody.linux-foundation.org>
In-Reply-To
<20070327172216.GA24200@informatik.uni-freiburg.de>
On Tue, 27 Mar 2007, Uwe Kleine-König wrote:
Show 6 quoted lines
> 
> 	embeddedproject$ git ls-tree HEAD | grep linux
> 	040000 commit 0123456789abcde0... linux-2.6
> 
> (or how ever you save submodules).  Then you might have to duplicate the
> objects of linux-2.6, because they are part of both histories.
No they are not. Unless you do it wrong.

The *only* object that is part of the superproject would be the tree that *contains* that entry itself.

We should *never* automatically follow such an entry down, *exactly* because that doesn't scale. So to actually follow that entry for something like a recursive, you'd literally "cd into linux, and start 'git diff' from commit 0123456.."

In other words, the subproject would be its own project, and the superproject never sees it as "part of itself". I really think, for example, that the "git diff" family of programs (diff-index, diff-tree, diff-files) and things like "git ls-tree" should literally:

 - have a mode where they don't even recurse into subprojects, and I 
   personally think that it could/should be the default!
 - when they recurse, they should literally (at least to begin with) do 
   that kind of "fork() ; if (child) { chdir(subproject); execve(myself) }" 

The latter is really to make sure that *even*by*mistake* we don't screw things up and tie the sub/superproject together too tightly.

I'm serious. I really think that the first version (which ends up being the one that sets semantics) should be very careful here, so that subprojects never get mixed up with the superproject.

And I'm also serious about the "don't recurse into subproject by default at all". If I'm at the superproject, and I maintain the superproject, I think the state of the subprojects themselves are a totally separate issue. It's quite a valid thing to do to maintain the build infrastructure, and if I'm the maintainer of that, and I do "git diff", I sure as hell don't want to wait for git to do "git diff" on the subprojects when there are 5000 of them!

Sure, "git diff" is fast (on the kernel, it takes me 0.069s on a clean tree), but

 - multiply that 0.069s by 5000 and it's not so fast any more
 - when you have a thousand subprojects, it's quite possible (even likely) 
   that all your directories won't fit in the cache any more, and suddenly 
   even a single "git diff" takes several seconds.

Really! Try this on the Linux tree (that "drop_caches" thing needs root privileges):

	echo 3 > /proc/sys/vm/drop_caches
	git diff

and see it take something like 5 seconds. Now, imagine that you have a hundred subprojects, and they're big enough that the caches are *never* warm.

People sometimes don't seem to understand what "scalability" really means. Scalability means that something that is so fast that you don't even *think* about it will become a major bottleneck when you do it a thousand times, and the working set has grown so big that it totally blows out several levels of caches (both CPU caches and disk caches)

		Linus
Previous: Uwe Kleine-KönigNext: Uwe Kleine-König
Message 35 of 61 in “.gitlink for Summer of Code”
  1. Eric LeshMar 25, 2007
  2. Matthieu MoyMar 25, 2007
  3. Shawn O. PearceMar 25, 2007
  4. Johannes SchindelinMar 25, 2007
  5. Shawn O. PearceMar 25, 2007
  6. Junio C HamanoMar 25, 2007
  7. Shawn O. PearceMar 25, 2007
  8. Petr BaudisMar 27, 2007
  9. Eric LeshMar 26, 2007
  10. Matthieu MoyMar 26, 2007
  11. Eric LeshMar 26, 2007
  12. Martin WaitzMar 26, 2007
  13. Josef WeidendorferMar 26, 2007
  14. Matthieu MoyMar 26, 2007
  15. Josef WeidendorferMar 26, 2007
  16. Matthieu MoyMar 27, 2007
  17. Martin WaitzMar 26, 2007
  18. Junio C HamanoMar 26, 2007
  19. Submodule object storeMartin Waitz, Mar 26, 2007
  20. Junio C HamanoMar 26, 2007
  21. Martin WaitzMar 26, 2007
  22. David LangMar 26, 2007
  23. Martin WaitzMar 26, 2007
  24. David LangMar 26, 2007
  25. Martin WaitzMar 27, 2007
  26. David LangMar 27, 2007
  27. Junio C HamanoMar 27, 2007
  28. Martin WaitzMar 27, 2007
  29. Uwe Kleine-KönigMar 27, 2007
  30. Uwe Kleine-KönigMar 27, 2007
  31. Martin WaitzMar 27, 2007
  32. Josef WeidendorferMar 27, 2007
  33. Martin WaitzMar 27, 2007
  34. Uwe Kleine-KönigMar 27, 2007
  35. Linus TorvaldsMar 27, 2007
  36. Uwe Kleine-KönigMar 27, 2007
  37. Linus TorvaldsMar 27, 2007
  38. Linus TorvaldsMar 27, 2007
  39. Martin WaitzMar 27, 2007
  40. Josef WeidendorferMar 26, 2007
  41. Junio C HamanoMar 26, 2007
  42. Linus TorvaldsMar 27, 2007
  43. David LangMar 27, 2007
  44. Linus TorvaldsMar 27, 2007
  45. Martin WaitzMar 27, 2007
  46. Daniel BarkalowMar 27, 2007
  47. Linus TorvaldsMar 27, 2007
  48. Daniel BarkalowMar 27, 2007
  49. Linus TorvaldsMar 27, 2007
  50. David LangMar 27, 2007
  51. Jakub NarebskiMar 27, 2007
  52. David LangMar 27, 2007
  53. Steven GrimmMar 27, 2007
  54. Daniel BarkalowMar 27, 2007
  55. Linus TorvaldsMar 27, 2007
  56. Josef WeidendorferMar 26, 2007
  57. Martin WaitzMar 26, 2007
  58. Jakub NarebskiMar 26, 2007
  59. Matthieu MoyMar 26, 2007
  60. Jakub NarebskiMar 27, 2007
  61. Shawn O. PearceMar 25, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.