[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
grep MBS_SUPPORT is a dog
From: |
Neal Nuckolls |
Subject: |
grep MBS_SUPPORT is a dog |
Date: |
Tue, 2 Nov 2004 10:45:20 -0800 |
System:
maytag$ uname -a
Linux maytag 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux
maytag$ cat /etc/redhat-release
Red Hat Linux release 9 (Shrike)
maytag$ rpm -q -f /bin/grep
grep-2.5.1-7
Description:
grep takes almost 2 seconds realtime when matching one or more lines
in a small /tmp textfile . When no lines are matched, it ran in
only a few milliseconds (reasonable). But when one or more lines matched,
it took over 1.8 *seconds* (not reasonable). The small text file
should easily be cached in-memory page cache (no i/o) .
Here's the file:
maytag$ wc -l /tmp/file
1832 /tmp/file
maytag$ ls -l /tmp/file
-rw------- 1 nn users 189220 Nov 2 09:51 /tmp/file
Here's the time for nomatch (ok):
maytag$ time /bin/grep -c jffjf /tmp/file
0
real 0m0.078s
user 0m0.070s
sys 0m0.010s
maytag$ time /bin/grep -c jffjf /tmp/file
0
real 0m0.077s
user 0m0.070s
sys 0m0.000s
Here's the time for match (not ok):
maytag$ time /bin/grep -c suspended /tmp/file
336
real 0m1.800s
user 0m1.790s
sys 0m0.010s
maytag$ time /bin/grep -c suspended /tmp/file
336
real 0m1.800s
user 0m1.790s
sys 0m0.010s
---
Downloading grep-2.5.1-7.8.src.rpm, compiling, and gprof'ing shows
100% of the time is in check_multibyte_string() .
I don't care a #*$% about multibyte character support.
Editing search.c and dfa.c to remove the "#define MBS_SUPPORT"
and the new grep performs reasonably:
maytag$ time /tmp/grep -c suspended /tmp/file
336
real 0m0.009s
user 0m0.010s
sys 0m0.000s
maytag$ time /tmp/grep -c suspended /tmp/file
336
real 0m0.009s
user 0m0.000s
sys 0m0.010s
MBS_SUPPORT is a dog. Please either fix it or disable it by default. sheesh.
neal nuckolls
address@hidden
- grep MBS_SUPPORT is a dog,
Neal Nuckolls <=