Re: minor regex speedup

Ralf Wildenhues <[email protected]>
Newsgroups gmane.comp.gnu.m4.patches
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.