From: Petr Baudis Date: Tue, 31 Jan 2006 23:27:32 GMT Subject: Re: Bottlenecks in git merge Message-ID: <20060131232731.GA31278@pasky.or.cz> In-Reply-To: <20060131213314.GA32131@ebar091.ebar.dtu.dk> Hello, Dear diary, on Tue, Jan 31, 2006 at 10:33:14PM CET, I got a letter where Peter Eriksen said that... > In connection with Ian Molton's question about merge have I played a > little with 'git merge' on the kernel sources. What I find is that a > merge can take quite some time, but I'm not sure where that time exactly > goes to. Here are the times I got: > > Recursive (default): 4m22.282s > Resolve (-s resolve): 3m23.548s > > > What is taking so long? it is difficult to benchmark for me since everything required for the merge (that is, both all the objects and the whole working tree) just won't fit into my caches (or Linux at least won't let it stay there for long enough). I ended up repeatedly calling the subcommands, but that obviously is not a real world usage pattern. Proportionally, the significant eaters of time for cg-merge (similar to -s resolve) are: git-merge-base --- 1s cached, 10s to 20s uncached git-read-tree -m --- 1s cached, 10s or more uncached git-read-tree -m -u --- 1m50s w/ heavy disk activity, but big part of it is writing blocks git-merge-index -a \ -o /bin/true --- 1s cached git-merge-index -a \ -o ~/cogito/cg-Xmergefile --- 1m27s with some disk activity (44s user, 20s sys) cg-Xmergefile is very similar to git-merge-one-file Note that the time spent by git-read-tree here is just checking out the new file versions, which is inevitable. ;-) The real killer here is therefore git-merge-one-file. Most frequent hits here are probably of the added-in-one case, resulting in two more fork()s, reloading the index like mad all the time. Comparing cg-merge to git-merge, one difference is that git-merge tries to do kind of "trivial" merge first (apparently even if -s was passed to it), the point of which kind of escapes me if you are using the resolve strategy, but which causes two git-update-index calls - even one can take good half a minute or more if your cache is cold. -- Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ Of the 3 great composers Mozart tells us what it's like to be human, Beethoven tells us what it's like to be Beethoven and Bach tells us what it's like to be the universe. -- Douglas Adams