• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: SLOW -[NSFileManager directoryContentsAtPath:matchingExtension:options:keepExtension:]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SLOW -[NSFileManager directoryContentsAtPath:matchingExtension:options:keepExtension:]


  • Subject: Re: SLOW -[NSFileManager directoryContentsAtPath:matchingExtension:options:keepExtension:]
  • From: Rosyna <email@hidden>
  • Date: Tue, 11 Apr 2006 09:47:40 -0700

That's why I said "if you need any kind of metadata about the file". If you don't, yes, the BSD calls are faster. But as soon as you need to get more than just basic file name info, Carbon is much faster as it can get that info *while* it is getting the list of files so it doesn't need to make an additional catalog lookup. The additional calls to getattrlist() can be very expensive for the BSD calls.

If you search the list archives, there have been many, many tests that confirm this.

Ack, at 4/11/06, Will Mason said:

There's also nothing wrong with using BSD calls: opendir(3), readdir(3), closedir(3). I'd be willing to bet (without empirical data) that those are actually the fastest of any of the proposed options.

 Cheers,
 Will

----- Original Message ----
From: Rosyna <email@hidden>
To: Pierre Bernard <email@hidden>; j o a r <email@hidden>
Cc: email@hidden
Sent: Tuesday, April 11, 2006 8:25:10 AM
Subject: Re: SLOW -[NSFileManager directoryContentsAtPath:matchingExtension:options:keepExtension:]


In that case I suggest you use an FSIterator with
FSGetCatalogInfoBulk(). There have been quite a few posts on this
subject on this list. Search the archives for FSGetCatalogInfoBulk().
FSGetCatalogInfoBulk() is probably the fastest method for directory
enumeration if you need any kind of metadata about the file (name,
directory, permissions, whatever).

Conversely, directoryContentsAtPath is probably the slowest method to
enumerate directories.

--


Sincerely, Rosyna Keller Technical Support/Holy Knight/Always needs a hug

Unsanity: Unsane Tools for Insanely Great People

It's either this, or imagining Phil Schiller in a thong.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: SLOW -[NSFileManager directoryContentsAtPath:matchingExtension:options:keepExtension:] (From: Will Mason <email@hidden>)

  • Prev by Date: Re: Size limit of NSData or NSFileHandle?
  • Next by Date: Re: Cocoa Dock Manager Functions
  • Previous by thread: Re: SLOW -[NSFileManager directoryContentsAtPath:matchingExtension:options:keepExtension:]
  • Next by thread: Is it possible to add datarows from cocoa to an Applescript DataSource?
  • Index(es):
    • Date
    • Thread