summaryrefslogtreecommitdiff
path: root/builtin-log.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-11 06:39:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-01-12 08:47:50 (GMT)
commita26345b6085340ebd61e156aa8154a80196bee0f (patch)
treed8aa79fd39d8d3418383d52dbad8f4b7401a8e93 /builtin-log.c
parentcb572206d9dac4ba52878e7e1a4a7028d85707ab (diff)
downloadgit-a26345b6085340ebd61e156aa8154a80196bee0f.zip
git-a26345b6085340ebd61e156aa8154a80196bee0f.tar.gz
git-a26345b6085340ebd61e156aa8154a80196bee0f.tar.bz2
grep: optimize built-in grep by skipping lines that do not hit
The internal "grep" engine we use checks for hits line-by-line, instead of letting the underlying regexec()/fixmatch() routines scan for the first match from the rest of the buffer. This was a major source of overhead compared to the external grep. Introduce a "look-ahead" mechanism to find the next line that would potentially match by using regexec()/fixmatch() in the remainder of the text to skip unmatching lines, and use it when the query criteria is simple enough (i.e. punt for an advanced grep boolean expression like "lines that have both X and Y but not Z" for now) and we are not running under "-v" (aka "--invert-match") option. Note that "-L" (aka "--files-without-match") is not a reason to disable this optimization. Under the option, we are interested if the file has any hit at all, and that is what we determine reliably with or without the optimization. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-log.c')
0 files changed, 0 insertions, 0 deletions