From: Nguyen Thai Ngoc Duy Date: Sat, 24 Dec 2011 10:55:14 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> (Sorry I replied without reading though the mail) 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". I assume this is gree_tree(), we have another form of pathspec matching here: tree_entry_interesting() and it's still a bunch of strcmp inside. Does strcmp show up in perf report? -- Duy