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

Re: Git benchmark - comparison with Bazaar, Darcs, Git and Mercurial

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Aug 1, 2007, 02:14 UTC
Message-ID
<alpine.LFD.0.999.0707311850220.4161@woody.linux-foundation.org>
In-Reply-To
<200708010216.59750.jnareb@gmail.com>
On Wed, 1 Aug 2007, Jakub Narebski wrote:
> 
> If I remember correctly there were some patches to git which tried to 
> better deal with large blobs. In this simple benchmark git was 
> outperformed by Mercurial and even Bazaar-NG a bit.
It's almost certainly not the binary blobs.

I think almost all the difference is from the cloning, without repacking the souce or using a local clone.

The default action for a git clone is to create a pack-file, and do a local clone as if you did it over the network. That is obviously much slower than using the "-l" flag for the _clone_ action, but it tends to be better for the end result - since you get a nice packed starting point, and none of the confusion with hardlinks etc.

[ Maybe I'm just a worry-wart, but hardlinking two repos still makes me 
  worried. Even though we never modify the object files. 
  Quite frankly, I almost wish we hadn't ever done "-l" at all, and I 
  cannot really suggest using it. Either use "-s" for the truly shared 
  repository, or use the default pack-generating one. The hardlinking one 
  was simple and made sense, but it's really not very nice.
  But that aversion to "git clone -l" is really totally illogical. The way 
  we do the object handling, hardlinking object files in git is just about 
  the most safe operation you can think of - and I *still* shudder at it ]

Now, I think the "always act as if you were network transparent" by default is great, but especially if you have never run "git gc" to generate a pack to begin with, it's going to be a very costly thing. And I think that's what the numbers show. That's the only op we do a *lot* worse on than we should.

(The "nonconflicting merge" is probably - once more - the diffstat generation that bites us. That's generally the most costly thing of the whole merge, but I *love* the diffstat).

That said, even if he had done a "git gc", to be fair he would have had to include the cost of that first garbage collect in the "initial import", so the end result would have been exactly the same. Git _does_ end up having a very odd performance profile, and while it's optimized for certain thing, the "initial import" is not one of them.

(Which admittedly is a bit odd. The reason I didn't ever seriously even consider monotone was that the initial import was so *incredibly* sucky, and took hours for the kernel. So use "-l" for benchmarks, and damn my "I hate hardlinking repos" idiocy).

So the only way to truly do a fast initial import *and* get a reasonably good initial clone is likely one of:

 - take full advantage of git, and use local branches, instead of 
   bothering with lots of clones.
   I think that this is often the right thing to do, but it's obviously 
   not fair for comparisons, since it's really something different from 
   what's likely available in the other SCM's. But it's the "git way".
 - use "git clone -s" (or "-l").
   I think the hg numbers are the result of hg defaulting to "-l" 
   behaviour.  Which makes sense for hg, since people need to clone more 
   (in git, you'd generally work with local branches instead).
 - or the initial import would be done with some "git fast-import" thing, 
   rather than "git add ." We don't do it now, and the resulting pack-file 
   wouldn't be optimal, but it would be reasonable. It would at least cut 
   down a _bit_ on the clone cost.

The other reaction I took away from that (quite reasonable, I think) comparison is that I think Murdock would have been much happier if git diff defaulted to "-C". We don't do that (for the best of reasons: interoperability), but maybe we should document the "-M/-C" options more.

The options do show up in the man-page, but apparently not obviously enough, since he hadn't noticed.

			Linus
Previous: Jakub NarebskiNext: Junio C Hamano
Message 2 of 29 in “Git benchmark - comparison with Bazaar, Darcs, Git and Mercurial”
  1. Jakub NarebskiAug 1, 2007
  2. Linus TorvaldsAug 1, 2007
  3. Junio C HamanoAug 1, 2007
  4. David KastrupAug 1, 2007
  5. Theodore TsoAug 1, 2007
  6. Junio C HamanoAug 1, 2007
  7. Alex RiesenAug 1, 2007
  8. Alex RiesenAug 1, 2007
  9. Alex RiesenAug 1, 2007
  10. Carl WorthAug 1, 2007
  11. Linus TorvaldsAug 1, 2007
  12. David KastrupAug 1, 2007
  13. Florian WeimerAug 1, 2007
  14. Junio C HamanoAug 2, 2007
  15. David KastrupAug 2, 2007
  16. Junio C HamanoAug 3, 2007
  17. David KastrupAug 3, 2007
  18. Johan HerlandAug 3, 2007
  19. Theodore TsoAug 1, 2007
  20. Brandon CaseyAug 1, 2007
  21. Allan WindAug 2, 2007
  22. Linus TorvaldsAug 2, 2007
  23. Jakub NarebskiAug 1, 2007
  24. Jakub NarebskiAug 2, 2007
  25. Ramsay JonesAug 2, 2007
  26. Jakub NarebskiAug 1, 2007
  27. Junio C HamanoAug 1, 2007
  28. Jakub NarebskiAug 1, 2007
  29. Shawn O. PearceAug 1, 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.