# Note on "git grep"

1 messages from 2006-07-12 to 2006-07-12. Participants: Linus Torvalds.
Thread: https://gitlist.dev/t/4863

## Linus Torvalds, 2006-07-12 21:33

Subject: Note on "git grep"
Message-ID: <Pine.LNX.4.64.0607121428300.5623@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0607121428300.5623%40g5.osdl.org

```

Heh. Since I've been bisecting a laptop of mine that keeps having ACPI 
problems, I notived something fun about "git grep".

Using the external "grep" is about 10 times faster for the hot-cache case, 
but for cold-cache, forcing the internal one is actually a _lot_ faster 
because a fully packed kernel archive just gets wonderfully better IO 
patterns than the "real filesystem" image.

So doing "git grep some-random-string HEAD" takes about 16 seconds 
cold-cache, and 11 seconds hot-cache.

In contrast, doing "git grep some-random-string" takes over a minute 
cold-cache, and about 2 seconds hot-cache. It's kind of sad that we can't 
dynamically notice which case we have, since the hot-cache case is _so_ 
much better for the external grep, but then cold-cache sucks for it..

I just thought I'd point this out to people, since I found it interesting 
how the built-in grep functionality actually outperforms the "real" one 
under some circumstances.

		Linus

```
