News for hackers. Stuff that matters.
Re:Grep too slow? Use git-grep by cjp on Tuesday July 09, 2013 @06:42PM (#6016189)
In a packed repo, git grep can mmap the pack file once and search through it in one fell swoop. If the pack file isn't already in the filesystem buffer, mmap will get it there quickly. The number of system calls is O(1).

The limitation, as others have said, is git grep won't match files that are not already checked in.

In a regular directory tree, recursive grep has to open and read directories, stat files, and read (or mmap?) each individual file. The number of system calls is O(N) on the number of directory entries.

There are no comments on this comment yet.