Re: [PATCH 2/2] grep: don't call regexec() for fixed strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



René Scharfe <rene.scharfe@xxxxxxxxxxxxxx> writes:

> 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):

Thanks, and...

>  static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
>  {
> -	int err = regcomp(&p->regexp, p->pattern, opt->regflags);
> +	int err;
> +
> +	if (opt->fixed || is_fixed(p->pattern))
> +		p->fixed = 1;
> +	if (opt->regflags & REG_ICASE)
> +		p->fixed = 0;

... thanks again for being extra careful.  That's why I *love* your
patches.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux