Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!van-bc!norsat!dbin From: dbin@norsat.UUCP (Dave Binette) Newsgroups: comp.unix.wizards Subject: Re: Anything faster than stat(S)? need to determine File or Dir Summary: ******* NO ****** Keywords: need more time in the CPUs known universe Message-ID: <159@norsat.UUCP> Date: 10 Nov 89 07:26:15 GMT References: <152@norsat.UUCP> <2586@unisoft.UUCP> Reply-To: dbin@norsat.UUCP (Dave Binette) Organization: Norsat International Research Inc. Surrey, BC, CANADA Lines: 63 The consensus for the question "Anything faster than stat(S)?" is "No" Now for plan "B" (ignore me if I am trying your patience) "Is there anything faster than opendir(S), and readdir(S)" I can't and don't want to use ftw(S) Or maybe I should just ask.... WHY does it take so LONG to count the number of directorys and files below "." I've written a little program called "ldir" that counts files and subdirs to the level you specify as in "ldir -d2" its not THAT slow but in my application it is used a lot and speed is... well you know the story. Tell ya what... I'll post it if you think you can do it faster, smaller and/or better. Here is what happens from vi when I do !!(cd /usr/spool/news/comp; time ldir -d2 [ab]*; w) ------------------------------------------------------------ ai ( 30 Files 6 Dirs) arch ( 64 Files 0 Dirs) archives ( 0 Files 0 Dirs) binaries (+ 9 Files 8 Dirs) bugs (+ 5 Files 5 Dirs) real 4.0 user 0.0 sys 0.5 11:05pm up 2 days, 4 mins, 2 users, load average: 0.19, 0.14, 0.01 ------------------------------------------------------------ Subsequent invocations produce: (obviously cached) ... real 0.8 user 0.0 sys 0.3 ... real 0.5 user 0.0 sys 0.3 Does the user time of 0.0 mean there is no hope? Where do the other 3.5 0.5 and 0.2 seconds go? (real - sys) Oh yeah, we are running: (Compaq 386-20, 5Meg Ram, 2 28ms ST4096) sysname=XENIX nodename=norsat release=2.3.1 version=SysV machine=i80386 -- My girlfriend is a screamer..., my computer just HUMMMMs uucp: {uunet,ubc-cs}!van-bc!norsat!dbin | 302-12886 78th Ave bbs: (604)597-4361 24/12/PEP/3 | Surrey BC CANADA voice: (604)597-6298 (Dave Binette) | V3W 8E7