author | Jeff King <peff@peff.net> | |
Thu, 2 Feb 2012 08:20:43 +0000 (03:20 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 2 Feb 2012 18:36:08 +0000 (10:36 -0800) | ||
commit | 94ad9d9e075d3f7802cf56641ebb342d43fb46e3 | |
tree | f309236155445727ba387091062cf75238710e78 | tree | snapshot |
parent | c876d6da88d9bf1f3377d4eed66fc7705e31c30e | commit | diff |
grep: cache userdiff_driver in grep_source
Right now, grep only uses the userdiff_driver for one thing:
looking up funcname patterns for "-p" and "-W". As new uses
for userdiff drivers are added to the grep code, we want to
minimize attribute lookups, which can be expensive.
It might seem at first that this would also optimize multiple
lookups when the funcname pattern for a file is needed
multiple times. However, the compiled funcname pattern is
already cached in struct grep_opt's "priv" member, so
multiple lookups are already suppressed.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Right now, grep only uses the userdiff_driver for one thing:
looking up funcname patterns for "-p" and "-W". As new uses
for userdiff drivers are added to the grep code, we want to
minimize attribute lookups, which can be expensive.
It might seem at first that this would also optimize multiple
lookups when the funcname pattern for a file is needed
multiple times. However, the compiled funcname pattern is
already cached in struct grep_opt's "priv" member, so
multiple lookups are already suppressed.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
grep.c | diff | blob | history | |
grep.h | diff | blob | history |