On Sat, 13 May 2006, Junio C Hamano wrote: > > * built-in grep (jc/grep) > > Ready. I'm not entirely convinced. For the kernel, I currently can do a git grep some-random-string in about half a second. The new built-in grep is about ten times slower. Before: [torvalds@g5 linux]$ /usr/bin/time git grep some-random-string Command exited with non-zero status 123 0.29user 0.30system 0:00.52elapsed 113%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+3206minor)pagefaults 0swaps After: [torvalds@g5 linux]$ /usr/bin/time git grep some-random-string Command exited with non-zero status 1 4.60user 0.33system 0:04.98elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+7369minor)pagefaults 0swaps and that "half a second" vs "five seconds" difference is really noticeable. Right now I do "git grep" as a random "ok, where was it", and it works very well, because it's basically instantaneous. And the difference between "instantaneous" and "5 seconds" is very big (the five seconds is also long enough that the CPU fan comes on on my G5, which is my sign of "too much work for the CPU". I haven't looked at _why_ the builtin grep is ten times slower. I suspect it's just the regexp library being a lot slower than the external optimized grep, but it may also be just overhead (it looks, for example, like the builtin grep does all matches just one line at a time. And it actually reads the file in, when mmap might be more efficient, I dunno). Regardless, it's a huge downer. Linus - : send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html