Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!cmcl2!husc6!panda!genrad!decvax!decwrl!reid From: reid@decwrl.DEC.COM (Brian Reid) Newsgroups: comp.sources.d Subject: Re: "look" utility? Message-ID: <8509@decwrl.DEC.COM> Date: Sun, 8-Mar-87 01:36:06 EST Article-I.D.: decwrl.8509 Posted: Sun Mar 8 01:36:06 1987 Date-Received: Mon, 9-Mar-87 03:00:25 EST References: <1916@cbdkc1.UUCP> <837@maynard.BSW.COM> <1145@ihlpf.ATT.COM> <846@maynard.BSW.COM> <271@crys.WISC.EDU> Reply-To: reid@decwrl.UUCP (Brian Reid) Organization: DEC Western Research Lines: 83 In article <271@crys.WISC.EDU> solomon@crys.WISC.EDU (Marvin Solomon) writes: > >Look is much faster than any of the greps, since ... >Fgrep is always the slowest ... >Egrep is always the fastest. Hi, Marvin. I'm always glad to see actual measured data on the network. But clearly you don't have the James Woods (ames!jaw) grep. At our site we call it ngrep. Here are the times for ngrep. Your machine CRYS.WISC.EDU is a Vax 780; I have a 785. Therefore I re-ran all of your tests, to avoid having to convert the numbers between dissimilar machines. Here is my output of your tests. Note that in every case, ngrep is faster than egrep by a huge amount in cpu time and by a significant amount in real time. $ time grep -l a /usr/dict/words 4.2 real 2.9 user 0.4 sys $ time fgrep -l a /usr/dict/words 0.5 real 0.0 user 0.1 sys $ time egrep -l a /usr/dict/words 0.2 real 0.0 user 0.1 sys $ time egrep -l \^a /usr/dict/words 0.2 real 0.0 user 0.1 sys $ time ngrep -l a /usr/dict/words 0.3 real 0.0 user 0.1 sys $ time ngrep -l a /usr/dict/words 0.2 real 0.0 user 0.1 sys $ $ $ time grep -l jade /usr/dict/words 3.7 real 2.3 user 0.4 sys $ time fgrep -l jade /usr/dict/words 2.5 real 1.5 user 0.3 sys $ time egrep -l jade /usr/dict/words 1.8 real 0.8 user 0.3 sys $ time egrep -l \^jade /usr/dict/words 2.5 real 0.9 user 0.3 sys $ time ngrep -l jade /usr/dict/words 1.0 real 0.1 user 0.2 sys $ time ngrep -l \^jade /usr/dict/words 2.3 real 0.3 user 0.8 sys $ $ $ time grep -l zygote /usr/dict/words 3.9 real 2.2 user 0.5 sys $ time fgrep -l zygote /usr/dict/words 4.5 real 3.1 user 0.5 sys $ time egrep -l zygote /usr/dict/words 3.3 real 1.8 user 0.4 sys $ time egrep -l \^zygote /usr/dict/words 3.1 real 1.7 user 0.4 sys $ time ngrep -l zygote /usr/dict/words 1.9 real 0.1 user 0.4 sys $ time ngrep -l \^zygote /usr/dict/words 2.7 real 0.2 user 0.8 sys $ However, that's just a Vax. If you want to see ngrep really sing, watch while I run it on a DECWRL's "Titan" machine, which is about 15 times the speed of a 780: $ time ngrep -l \^Zurich /usr/dict/words 3.7 real 0.0 user 1.5 sys The real time is slower because my Titan has only one disk, and the disk arms must move back and forth between /usr/dict and /bin/ngrep. I can reduce the effect of having only one disk arm by using a longer file to search: $ ls -l /usr/dict/words -rw-r--r-- 1 root 201314 Nov 5 10:43 /usr/dict/words $ ls -l /usr/dict/web2 -rw-r--r-- 1 reid 2498185 Aug 13 1985 /usr/dict/web2 $ tail -1 /usr/dict/web2 Zyzzogeton $ time egrep -l Zyzzogeton /usr/dict/web2 /usr/dict/web2 10.3 real 5.1 user 2.5 sys $ time ngrep -l Zyzzogeton /usr/dict/web2 /usr/dict/web2 7.8 real 0.4 user 2.3 sys Conclusion: be careful with claims about how fast egrep is, since ngrep is almost always significantly faster.