title: What is the performance characteristics of NSDirectoryEnumerator' fileAttributes method?
body: <p>How expensive is it to call the fileAttributes method when iterating over a directory?</p>
  
  <p>In particular, I'd like to check if a path being enumerated is a directory. Is it better to use the fileAttributes dictionary or the file manager? (example below)</p>
  
  <pre><code>NSString *path = "/User/Jack/Documents";
  NSDirectoryEnumerator *dirEnum = [filemanager enumeratorAtPath:path];
  NSString *file;
  BOOL isDir;
  while (file = [dirEnum nextObject]) {
      NSLog(@"File: %@", file);
      NSString * p = [path stringByAppendingPathComponent:file];
      BOOL isDir1;
      [[NSFileManager defaultManager] fileExistsAtPath:p isDirectory:&amp;isDir1];
      BOOL isDir2 = [[dirEnum fileAttributes] objectForKey:@"NSFileType"] == NSFileTypeDirectory;
      NSLog(@"isDirectory using fileExistsAtPath:isDirectory: = %d", isDir1);
      NSLog(@"isDirectory using FileAttributes = %d", isDir2);        
  }
  </code></pre>
  
  <p><code>fileAttributes</code> returns a ton of "unnecessary" information in addition to just isDirectory, here's a sample output</p>
  
  <pre><code>2011-12-23 16:17:40.523 App[10190:707] File Attributes: {
      NSFileCreationDate = "2011-10-23 04:04:51 +0000";
      NSFileExtensionHidden = 0;
      NSFileGroupOwnerAccountID = 80;
      NSFileGroupOwnerAccountName = admin;
      NSFileModificationDate = "2011-10-23 04:07:52 +0000";
      NSFileOwnerAccountID = 501;
      NSFileOwnerAccountName = Tony;
      NSFilePosixPermissions = 493;
      NSFileReferenceCount = 6;
      NSFileSize = 204;
      NSFileSystemFileNumber = 8381694;
      NSFileSystemNumber = 234881029;
      NSFileType = NSFileTypeDirectory;
  }
  </code></pre>
  
  <p>Whereas calling fileManager seems wasteful as well since we are already enumerating the directory in question. </p>
  
  <p>Any insights?</p>