All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 2/2] grep: don't call regexec() for fixed strings
Date: Sat, 10 Jan 2009 12:37:09 -0800	[thread overview]
Message-ID: <7vbpuex5hm.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 4967DB4A.2000702@lsrfire.ath.cx

René Scharfe <rene.scharfe@lsrfire.ath.cx> 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.

  reply	other threads:[~2009-01-10 20:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-09 23:08 [PATCH 1/2] grep -w: forward to next possible position after rejected match René Scharfe
2009-01-09 23:18 ` [PATCH 2/2] grep: don't call regexec() for fixed strings René Scharfe
2009-01-10 20:37   ` Junio C Hamano [this message]
2009-01-12 12:25   ` Mikael Magnusson
2009-01-12 13:33     ` Johannes Schindelin
2009-01-12 15:32   ` Alex Riesen
2009-01-12 19:18     ` René Scharfe
2009-01-13  8:13       ` Junio C Hamano
2009-01-17 15:50         ` [PATCH 1/4] Add ctype test René Scharfe
2009-01-17 15:50         ` [PATCH 2/4] Reformat ctype.c René Scharfe
2009-01-17 15:50         ` [PATCH 3/4] Change NUL char handling of isspecial() René Scharfe
2009-01-17 15:50         ` [PATCH 4/4] Add is_regex_special() René Scharfe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vbpuex5hm.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=rene.scharfe@lsrfire.ath.cx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.