- Fixes to egf-speedup patch: now it does not change any functionality, as

intended.
- GREP_NO_DFA now turns off the DFA engine, for performance testing.
This commit is contained in:
Tim Waugh 2004-11-05 18:09:53 +00:00
parent 2bb2860efe
commit d619d25368
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,56 @@
--- grep-2.5.1/src/search.c.dfa-optional 2004-11-05 16:16:45.230641568 +0000
+++ grep-2.5.1/src/search.c 2004-11-05 16:36:19.679817421 +0000
@@ -305,11 +305,19 @@
int backref, start, len;
struct kwsmatch kwsm;
size_t i, ret_val;
+ static int use_dfa;
+ static int use_dfa_checked = 0;
#ifdef MBS_SUPPORT
mbstate_t mbs;
memset (&mbs, '\0', sizeof (mbstate_t));
#endif /* MBS_SUPPORT */
+ if (!use_dfa_checked)
+ {
+ use_dfa = (getenv ("GREP_NO_DFA") == NULL);
+ use_dfa_checked = 1;
+ }
+
buflim = buf + size;
for (beg = end = buf; end < buflim; beg = end)
@@ -365,7 +373,8 @@
--beg;
if (kwsm.index < kwset_exact_matches)
goto success_in_beg_and_end;
- if (dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1)
+ if (use_dfa &&
+ dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1)
continue;
}
else
@@ -374,7 +383,9 @@
#ifdef MBS_SUPPORT
size_t bytes_left = 0;
#endif /* MBS_SUPPORT */
- size_t offset = dfaexec (&dfa, beg, buflim - beg, &backref);
+ size_t offset = 0;
+ if (use_dfa)
+ offset = dfaexec (&dfa, beg, buflim - beg, &backref);
if (offset == (size_t) -1)
break;
/* Narrow down to the line we've found. */
@@ -450,7 +461,11 @@
if ((start == 0 || !WCHAR ((unsigned char) beg[start - 1]))
&& (len == end - beg - 1
|| !WCHAR ((unsigned char) beg[start + len])))
- goto success_in_start_and_len;
+ {
+ if (len == 0)
+ len++;
+ goto success_in_start_and_len;
+ }
if (len > 0)
{
/* Try a shorter length anchored at the same place. */

View File

@ -1,7 +1,7 @@
Summary: The GNU versions of grep pattern matching utilities. Summary: The GNU versions of grep pattern matching utilities.
Name: grep Name: grep
Version: 2.5.1 Version: 2.5.1
Release: 34 Release: 35
License: GPL License: GPL
Group: Applications/Text Group: Applications/Text
Source: ftp://ftp.gnu.org/pub/gnu/grep/grep-%{version}.tar.bz2 Source: ftp://ftp.gnu.org/pub/gnu/grep/grep-%{version}.tar.bz2
@ -11,6 +11,7 @@ Patch2: grep-2.5-i18n.patch
Patch3: grep-2.5.1-oi.patch Patch3: grep-2.5.1-oi.patch
Patch4: grep-2.5.1-manpage.patch Patch4: grep-2.5.1-manpage.patch
Patch5: grep-2.5.1-egf-speedup.patch Patch5: grep-2.5.1-egf-speedup.patch
Patch6: grep-2.5.1-dfa-optional.patch
URL: http://www.gnu.org/software/grep/ URL: http://www.gnu.org/software/grep/
Prereq: /sbin/install-info Prereq: /sbin/install-info
Buildroot: %{_tmppath}/%{name}-%{version}-root Buildroot: %{_tmppath}/%{name}-%{version}-root
@ -34,6 +35,7 @@ utility for searching through text.
%patch3 -p1 -b .oi %patch3 -p1 -b .oi
%patch4 -p1 -b .manpage %patch4 -p1 -b .manpage
%patch5 -p1 -b .egf-speedup %patch5 -p1 -b .egf-speedup
%patch6 -p1 -b .dfa-optional
%build %build
[ ! -e configure ] && ./autogen.sh [ ! -e configure ] && ./autogen.sh
@ -81,6 +83,11 @@ fi
%{_mandir}/*/* %{_mandir}/*/*
%changelog %changelog
* Fri Nov 5 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-35
- Fixes to egf-speedup patch: now it does not change any functionality,
as intended.
- GREP_NO_DFA now turns off the DFA engine, for performance testing.
* Thu Nov 4 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-34 * Thu Nov 4 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-34
- More improvements to egf-speedup patch (bug #138076). - More improvements to egf-speedup patch (bug #138076).