|
|
|
|
|
by cjp
4721 days ago
|
|
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. |
|