Xref: utzoo comp.unix.shell:588 comp.unix.internals:673 Path: 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> <26919@mimsy.umd.edu> Reply-To: mercer@npdiss1.StPaul.NCR.COM (Dan Mercer) Organization: StPaul Lines: 30 In article <26919@mimsy.umd.edu> chris@mimsy.umd.edu (Chris Torek) writes: :In article 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"