Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Jul 1999 22:07:26 -0400
From:      Tim Vanderhoek <vanderh@ecf.utoronto.ca>
To:        Dag-Erling Smorgrav <des@flood.ping.uio.no>
Cc:        John-Mark Gurney <gurney_j@resnet.uoregon.edu>, James Howard <howardjp@wam.umd.edu>, "Daniel C. Sobral" <dcs@newsguy.com>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: replacing grep(1)
Message-ID:  <19990730220726.A69246@mad>
In-Reply-To: <xzpyafy1d53.fsf@flood.ping.uio.no>; from Dag-Erling Smorgrav on Fri, Jul 30, 1999 at 03:27:20PM %2B0200
References:  <19990729182229.E24296@mad> <Pine.GSO.4.10.9907291856100.11776-100000@rac9.wam.umd.edu> <19990729164533.36798@hydrogen.fircrest.net> <xzpyafy1d53.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jul 30, 1999 at 03:27:20PM +0200, Dag-Erling Smorgrav wrote:
> 
> Funnily, I experience a near-doubling of running time with similar
> patches.

Incidentally, it seems that it's not possible to assume that our
regex library is even anywhere in the same league as the GNU regex
library.

b$ time ./grep -E '(vt100)|(printer)' longfile > /dev/null

real    0m21.284s
user    0m22.034s
sys     0m0.083s

Now, with a profiled executable with optimization turned off it
takes about 25 seconds.  Regardless, it appears to spend 98% of
its time in regexec(), which is good, since that's where it should
be spending time.

[I had been intending to combine multiple patterns, ultimately
 combining in a '\n' to avoid the memchr() in mmopen].

b$ time grep '(vt100)|(printer)' longfile > /dev/null

real    0m0.267s
user    0m0.109s
sys     0m0.157s

98% * 20 = ~19...  Without an improved regex library, any mildly
complicated pattern will bring the new grep to its knees.

This could be the dfa helping GNU grep more than having a better
regexp library...  Probably both.

I wonder how well the devel/pcre port would do POSIX regular expressions.


-- 
This is my .signature which gets appended to the end of my messages.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990730220726.A69246>