Date: Sun, 22 Aug 2010 18:36:44 +0200 From: Ed Schouten <ed@80386.nl> To: Mike Haertel <mike@ducky.net> Cc: freebsd-current@freebsd.org, gabor@freebsd.org Subject: Re: why GNU grep is fast Message-ID: <20100822163644.GU2978@hoeg.nl> In-Reply-To: <201008210231.o7L2VRvI031700@ducky.net> References: <201008210231.o7L2VRvI031700@ducky.net>
next in thread | previous in thread | raw e-mail | index | archive | help
--Zu4V1sHRt6IpqgDQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Mike Haertel <mike@ducky.net> wrote: > Moreover, GNU grep AVOIDS BREAKING THE INPUT INTO LINES. Looking > for newlines would slow grep down by a factor of several times, > because to find the newlines it would have to look at every byte! I think that implementing a simple fgrep boils down to mmap()ing a file and calling memmem() on the mapping to search for the input string. Of course this relies on having an efficient memmem() implementation, for example using one of the algorithms mentioned in this thread. --=20 Ed Schouten <ed@80386.nl> WWW: http://80386.nl/ --Zu4V1sHRt6IpqgDQ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkxxUhwACgkQ52SDGA2eCwUZkQCcDc4rDxdk9c9GEH8duXUt42Vc g4EAnRCjEnYVt9eS8tvuE0if6BWUUFOw =yYgr -----END PGP SIGNATURE----- --Zu4V1sHRt6IpqgDQ--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100822163644.GU2978>