From 3f39ffc893961a8e73eea2bb70fed8ed11e0edd2 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Fri, 21 Apr 2017 14:36:09 +0000 Subject: bsdgrep: add BSD_GREP_FASTMATCH knob for built-in fastmatch Bugs have been found in the fastmatch implementation as used in bsdgrep. Some have been fixed (r316495) while fixes for others are in review (D10098). In comparison with the fastmatch implementation, Kyle Evans found that: - regex(3)'s performance with literal expressions offers a speed improvement over fastmatch - regex(3)'s performance, both with simple BREs and EREs, seems to be comparable The regex implementation was imported in r226035, and the commit message reports: This is a temporary solution until the whole regex library is not replaced so that BSD grep development can continue and the backported code gets some review and testing. This change only improves scalability slightly, there is no big performance boost yet but several minor bugs have been found and fixed. Introduce a WITH_/WITHOUT_BSD_GREP_FASTMATCH knob to support testing of both approaches. PR: 175314, 194823 Submitted by: Kyle Evans Reviewed by: bdrewery (in part) Differential Revision: https://reviews.freebsd.org/D10282 --- usr.bin/grep/grep.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'usr.bin/grep/grep.h') diff --git a/usr.bin/grep/grep.h b/usr.bin/grep/grep.h index c82e6bb9cbc9..ea17af4099dd 100644 --- a/usr.bin/grep/grep.h +++ b/usr.bin/grep/grep.h @@ -36,7 +36,9 @@ #include #include +#ifndef WITHOUT_FASTMATCH #include "fastmatch.h" +#endif #ifdef WITHOUT_NLS #define getstr(n) errstr[n] @@ -127,7 +129,9 @@ extern unsigned int dpatterns, fpatterns, patterns; extern struct pat *pattern; extern struct epat *dpattern, *fpattern; extern regex_t *er_pattern, *r_pattern; +#ifndef WITHOUT_FASTMATCH extern fastmatch_t *fg_pattern; +#endif /* For regex errors */ #define RE_ERROR_BUF 512 -- cgit v1.2.3