From: Nguyen Thai Ngoc Duy Date: Sun, 25 Dec 2011 03:32:27 GMT Subject: Re: [PATCH v2 3/3] grep: disable threading in all but worktree case Message-ID: In-Reply-To: <20111224070715.GA32267@sigill.intra.peff.net> On Sat, Dec 24, 2011 at 2:07 PM, Jeff King wrote: > The case where we would most expect the setup cost to be drowned out is > using a more complex regex, grepping tree objects. There we have a > baseline of: > >  $ time git grep 'a.*c' HEAD >/dev/null >  real    0m5.684s >  user    0m5.472s >  sys     0m0.196s > >  $ time git ls-tree --name-only -r HEAD | >      xargs git grep 'a.*c' HEAD -- >/dev/null >  real    0m10.906s >  user    0m10.725s >  sys     0m0.240s > > Here, we still almost double our time. It looks like we don't use the > same pathspec matching code in this case. But we do waste a lot of extra > time zlib-inflating the trees in "ls-tree", only to do it separately in > "grep". Or you could pass blob SHA-1 to git grep to avoid reinflating trees $ time git ls-tree -r HEAD|cut -c 13-52|xargs git grep 'a.*c' >/dev/null Doing it in parallel does not seem to save time for me though. -- Duy