Faster Searching !

micheal sundance at sundanceloki.com
Mon Feb 7 04:21:39 UTC 2005


On Sun, 2005-02-06 at 21:44 -0600, Thomas Cameron wrote:
> ----- Original Message ----- 
> From: "fly over" <fly_over at soon.com>
> To: "Paul Howarth" <paul at city-fan.org>; <fedora-list at redhat.com>
> Sent: Sunday, February 06, 2005 9:23 PM
> Subject: Faster Searching !
> 
> 
> > Hi Guruz ,
> >
> > I want to ask about the fastest searching command as i am using to search 
> > SUID/GUID files in / directory . script given as:
> >
> >        ls -l /usr/bin | awk '/^-.....[s]/ { print $3, $9 }'
> >
> > or using 'find' utility as below
> >
> >
> >        find /usr/bin -perm +6000
> >
> >
> >
> > now the question is  Which works faster, script without 'find' or with it? 
> > and How do you know?
> >
> > thankx.
> 
> Run each command under /usr/bin/time:
> 
> /usr/bin/time ls -l /usr/bin | awk '/^-.....[s]/ { print $3, $9 }'
> 
> /usr/bin/time find /usr/bin -perm +6000
> 
> My bets are on the find command - the ls command relies on a pipe to a 
> completely different command, which is going to slow the whole process down 
> a bunch.
> 
> Thomas 
> 
And for the perpetually curious:

Find

real    0m0.025s
user    0m0.002s
sys     0m0.019s

ls awk combo

real    0m0.127s
user    0m0.092s
sys     0m0.042s






More information about the fedora-list mailing list