Re: Faster Searching !

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2005-02-06 at 22:21 -0600, micheal wrote:
> On Sun, 2005-02-06 at 21:44 -0600, Thomas Cameron wrote:
> > ----- Original Message ----- 
> > From: "fly over" <fly_over@xxxxxxxx>
> > To: "Paul Howarth" <paul@xxxxxxxxxxxx>; <fedora-list@xxxxxxxxxx>
> > 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
> 
and on mine  this was 6% CPU with 183 minor page faults

> ls awk combo
> 
> real    0m0.127s
> user    0m0.092s
> sys     0m0.042s
> 
this was 20% CPU with 518 minor page faults.
(after running find, so the directory data was probably already in
cache)

The clear winner ----->>   find
 



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux