m4-patches
[Top][All Lists]
Advanced

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

Re: minor regex speedup


From: Ralf Wildenhues
Subject: Re: minor regex speedup
Date: Mon, 18 Feb 2008 12:23:22 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Hi Eric,

Eric Blake <ebb9 <at> byu.net> writes:
> +
> +     Use fastmaps for better regex performance.
[...]
> diff --git a/src/builtin.c b/src/builtin.c
> index c89ad44..a48e7a0 100644
> --- a/src/builtin.c
> +++ b/src/builtin.c
> @@ -298,6 +298,8 @@ compile_pattern (const char *str, size_t len, struct 
> re_pattern_buffer **buf,
>        free (new_buf);
>        return msg;
>      }
> +  /* Use a fastmap for speed; it is freed by regfree.  */
> +  new_buf->fastmap = xcharalloc (256);
[...]

I haven't otherwise looked at this patch at all, but it contains several
instances of the number 256.  As it is unqual to 0, 1, or 2, please make
that one or more #defines or consts, and use them throughout.

Thank you,
Ralf





reply via email to

[Prev in Thread] Current Thread [Next in Thread]