2

I'm just playing around with NSFileManager and getting a large list of files (~200,000) from a directory.

In both available methods:

- (NSArray *)contentsOfDirectoryAtURL:(NSURL *)url includingPropertiesForKeys:(NSArray *)keys options:(NSDirectoryEnumerationOptions)mask error:(NSError **)error

and:

- (NSDirectoryEnumerator *)enumeratorAtURL:(NSURL *)url includingPropertiesForKeys:(NSArray *)keys options:(NSDirectoryEnumerationOptions)mask errorHandler:(BOOL (^)(NSURL *url, NSError *error))handler

There is a part to specify keys (includingPropertiesForKeys:) for stuff that should be pre-cached. However what I have noticed is that there is absolutely no difference whether I provide nil for that parameter or whether I provide the keys that I need i.e.: @[NSURLContentModificationDateKey, NSURLFileSizeKey]

No difference in execution speed and no difference in memory consumption(for both methods)

Does someone have some experience with this? Whats the purpose of that parameter then?

4

0 回答 0