git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Note on "git grep"

From
Linus Torvalds <torvalds@osdl.org>
Date
Jul 12, 2006, 21:33 UTC
Message-ID
<Pine.LNX.4.64.0607121428300.5623@g5.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
Message 1 of 1 in “Note on "git grep"”
  1. Linus TorvaldsJul 12, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.