Re: [PATCH v2 3/3] grep: disable threading in all but worktree case
On Sat, Dec 24, 2011 at 2:07 PM, Jeff King <peff@peff.net> wrote:
Show 19 quoted lines
> 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