author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | |
Sat, 7 Mar 2009 12:27:15 +0000 (13:27 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 7 Mar 2009 19:34:53 +0000 (11:34 -0800) | ||
commit | 252d560d215581637fcddd7a0a18f89204ecc8d1 | |
tree | 2dcb202b0e77bdf077537425231461f917624515 | tree | snapshot |
parent | 8cc3fe45c92a2e85400a6ee83c3b3a4a8ca1d6c7 | commit | diff |
grep: micro-optimize hit collection for AND nodes
In addition to returning if an expression matches a line,
match_expr_eval() updates the expression's hit flag if the parameter
collect_hits is set. It never sets collect_hits for children of AND
nodes, though, so their hit flag will never be updated. Because of
that we can return early if the first child didn't match, no matter
if collect_hits is set or not.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
In addition to returning if an expression matches a line,
match_expr_eval() updates the expression's hit flag if the parameter
collect_hits is set. It never sets collect_hits for children of AND
nodes, though, so their hit flag will never be updated. Because of
that we can return early if the first child didn't match, no matter
if collect_hits is set or not.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
grep.c | diff | blob | history |