• R
    grep: don't call regexec() for fixed strings · c822255c
    René Scharfe 提交于
    Add the new flag "fixed" to struct grep_pat and set it if the pattern
    is doesn't contain any regex control characters in addition to if the
    flag -F/--fixed-strings was specified.
    
    This gives a nice speed up on msysgit, where regexec() seems to be
    extra slow.  Before (best of five runs):
    
    	$ time git grep grep v1.6.1 >/dev/null
    
    	real    0m0.552s
    	user    0m0.000s
    	sys     0m0.000s
    
    	$ time git grep -F grep v1.6.1 >/dev/null
    
    	real    0m0.170s
    	user    0m0.000s
    	sys     0m0.015s
    
    With the patch:
    
    	$ time git grep grep v1.6.1 >/dev/null
    
    	real    0m0.173s
    	user    0m0.000s
    	sys     0m0.000s
    
    The difference is much smaller on Linux, but still measurable.
    Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    c822255c
grep.h 1.8 KB