• 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: Status of getdirentriesattr()?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Status of getdirentriesattr()?


  • Subject: Re: Status of getdirentriesattr()?
  • From: James Bucanek <email@hidden>
  • Date: Mon, 10 Sep 2012 18:52:40 -0700

Jim Luther <mailto:email@hidden> wrote (Monday, September 10, 2012 2:33 PM -0700):

By the way, if CFURLEnumerator and the file system properties supported by NS/CFURL include everything you need, then I've already done everything you were asking about. CFURLEnumerator uses getdirentriesattr() if the file system supports VOL_CAP_INT_READDIRATTR and the propertyKeys requested are all supported by getdirentriesattr(); otherwise, it uses readdir() and getattrlist().

I tried using NSURL (which I assume bridges to CFURL) first, but I was looking for better performance. It's probably all of the object-oriented overhead, but using NSDirectoryEnumerator was considerably slower than creating lightweight wrapper objects from data obtained with getdirentriesattr().

This first test used NSDirectoryEnumerator to get the following attributes: NSURLNameKey, NSURLLocalizedNameKey, NSURLFileResourceTypeKey, NSURLIsDirectoryKey, NSURLCreationDateKey, NSURLContentModificationDateKey, and NSURLAttributeModificationDateKey.

URLTest[82534:303] starting: URLFullEnumer
URLTest[82534:303]     518899 items
URLTest[82534:303]     elapsed time: 51.789624
URLTest[82534:303]     average: 0.000100
URLTest[82534:303]     items/second: 10019.362184

My code uses getdirentriesattr() to get these attributes: ATTR_CMN_NAME, ATTR_CMN_OBJTYPE, ATTR_CMN_MODTIME, ATTR_CMN_CHGTIME, ATTR_CMN_ACCTIME, ATTR_CMN_OWNERID, ATTR_CMN_GRPID, ATTR_CMN_FLAGS, ATTR_DIR_ENTRYCOUNT, ATTR_DIR_MOUNTSTATUS, ATTR_FILE_LINKCOUNT, ATTR_FILE_DATALENGTH, and ATTR_FILE_RSRCLENGTH.

URLTest[82324:303] starting: DDBatchRecursive
URLTest[82324:303]     518899 items
URLTest[82324:303]     elapsed time: 31.136244
URLTest[82324:303]     average: 0.000060
URLTest[82324:303]     items/second: 16665.433377

The time spent in getdirentriesattr() by both tests is about the same, but the NSDirectoryEnumerator version then spends an inordinate amount of time in _FSURLCachePropertiesForKeys and _FSURLCreateWithPathAndAttributes. I'm assuming these functions are creating all of the objects used to represent the various attribute properties. For my application, this is undesirable overhead.

James
--
James Bucanek


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Status of getdirentriesattr()? (From: Jim Luther <email@hidden>)

  • Prev by Date: Re: Status of getdirentriesattr()?
  • Next by Date: Re: measurement of read/writes
  • Previous by thread: Re: Status of getdirentriesattr()?
  • Next by thread: Apple Raid Snapshots
  • Index(es):
    • Date
    • Thread