threads / discuss / 4863

Note on "git grep"

Subject: Note on "git grep"

## tl;dr

One message between Jul 12, 2006 and Jul 12, 2006.

replies: 0people: 1as markdown or json

Linus Torvalds· Jul 12, 2006, 21:33 UTC · lore

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

← back to recent threads