On Mon, 4 Jan 2010, Linus Torvalds wrote:
- external grep:
[torvalds@nehalem linux]$ time git grep qwerty
...
real 0m0.412s
user 0m0.196s
sys 0m0.132s
- NO_EXTERNAL_GREP:
[torvalds@nehalem linux]$ time ~/git/git grep qwerty
...
real 0m1.006s
user 0m0.900s
sys 0m0.096s
so that's not even close.
Side note: at least for me, if we did some auto-parallelization, the
internal grep would make up for all its other suckiness. Do four or eight
greps in parallel, and buffer the results (you still need to show them in
the right order).
That might be an acceptable way to "fix" it. Developers pretty much all
have at least two cores these days, some of us have four+HT. We use
threads in other places, maybe this could be one more of them.
(Start 'n' threads, do an initial per-thread regex and 'regcomp()' to make
it thread-safer, and the only interesting issue would be serializing the
output. Whenever you get a result, you'd need to make sure that all files
before have been completed, but you could do that all under a specific
lock that protects completion information).
Linus