🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1471

Re: Why is find so slow (Re: Why use find?)

#1471
From: Dan Mercer
Date: Mon, 15 Oct 1990 19:17
30 lines
1750 bytes
In article <26919@mimsy.umd.edu> chris@mimsy.umd.edu (Chris Torek) writes:
:In article <F6.rhxm2@cs.psu.edu> flee@guardian.cs.psu.edu (Felix Lee) writes:
:>"descend" is fast because it recognizes leaf directories and avoids
:>stat()ing the files in that directory.  This is usually a big win,
:>since most files tend to be in leaf directories.
:>
:>"find" can't do this in general, since most of its predicates require
:>stat()ing each file, but it wouldn't be too hard to add lazy stat()ing
:>to find.  And it may even be worth it.
:
:Quite likely.
:
:4.3BSD-reno's `find' reimplementation (a redistributable version) uses
:the C library `fts' routines (from POSIX) which take flags indicating
:whether `stat's are desired.  If you say `no', it stats only when this
:is required to search the directory.  The new find sets the `I need
:stat information' only when at least one predicate requires it.  The
:result:

Maybe I'm dense,  but how does find know whether a file is a directory
(and should be descended) or another type of file without stat()ing the
file?



-- 

Dan Mercer
Reply-To: mercer@npdiss1.StPaul.NCR.COM (Dan Mercer)
"MAN - the only one word oxymoron in the English Language"
Technical Details
Message-ID: <638@npdiss1.StPaul.NCR.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ncrlnk!ncrstp!npdiss1!mercer
References: <1990Sep30.182331.14363@iconsys.uucp> <941@hls0.hls.oz> <F6.rhxm2@cs.psu.edu> <26919@mimsy.umd.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ncrlnk!ncrstp!npdiss1!mercer
From: mercer@npdiss1.StPaul.NCR.COM (Dan Mercer)
Newsgroups: comp.unix.shell,comp.unix.internals
Subject: Re: Why is find so slow (Re: Why use find?)
Message-ID: <638@npdiss1.StPaul.NCR.COM>
Date: 15 Oct 90 19:17:40 GMT
References: <1990Sep30.182331.14363@iconsys.uucp> <941@hls0.hls.oz> <F6.rhxm2@cs.psu.edu> <26919@mimsy.umd.edu>
Reply-To: mercer@npdiss1.StPaul.NCR.COM (Dan Mercer)
Organization: StPaul
Lines: 30