Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!usc!apple!portal!sv!daven From: daven@svc.portal.com Newsgroups: comp.sys.mac.programmer Subject: Re: PBGetFInfo takes forever to return Message-ID: <1990Dec22.001744.14696@svc.portal.com> Date: 22 Dec 90 00:17:44 GMT References: <5184.2771e29c@cc.curtin.edu.au> Organization: Software Ventures Lines: 37 In article <5184.2771e29c@cc.curtin.edu.au> Lewis_P@cc.curtin.edu.au (Peter Lewis) writes: >Hi All, > Does anyone know why PBGetFInfo with a file index that is greater than >the number of files in the directory takes a huge amount of time to return? >(On a Plus with the cache disabled, it can take well over a second! >Turning on the cache helps, but it still takes a long time). This wouldnt >be so bad, but what I want to do requires that I call PBGetFInfo in this >way many times (several hundred), so what should take a couple seconds >takes over a minute. Has anyone else come across this? I've tried it on a >vanila system (6.0.2), so it isnt any nasty inits. (I don't think I have >lost my mind yet, but I may in the near future :-). Well, as they say: "If it hurts, don't do it." > Alternatively, is there anyway to determine the number of files in a >folder? (I know there is a way of determining the number of files&folders >in a folder, but I need to know how many files there are - It might >actually be quicker to use GetCatInfo, and ignore folders and do the >indexing myself, but this would be VERY messy). You'd be better off in the long run using GetCatInfo, and stepping over folders. One thing to beware of... if your code is examining a directory that is on a shared volume, then there's the very real possibility of the count of files changing while you're indexing through the directory. All sorts of wonderfully strange things can happen if files appear and disappear while you're indexing along. It can cause you to skip files, or see the same file more than once. I'd love to hear what sort of fixes people have tried for this. I know of one that Disinfectant uses which probably works in most cases. -- ------------------------------------------------------------------------------- Dave Newman | daven@svc.portal.com | AppleLink: D0025 Sofware Ventures Corp. | AOL: MicroPhone | CIS: 76004,2161 Berkeley, CA 94705 | WELL: tinman@well.sf.ca.us | (415) 644-3232