Slow NSFileProviderEnumerator

Hello,

I'm having some problems in implementing a File Provider based app. NSFileProviderEnumerator is very slow for many files (over 2000 files). I'm using pagination like this:

observer.didEnumerate(paged_files) // page size is usually 200

let nextPage = NSFileProviderPage((page + 1).description.data(using: .utf8)!) observer.finishEnumerating(upTo: nextPage)

and observer.finishEnumerating(upTo: nil) when finished all pages.

But after calling "observer.finishEnumerating(upTo: nil)" it still takes a lot of time (20-30 seconds) until all files are listed in Finder.

Any tips? Thank you.

I got the exact same issue but I think the problem is that the "didEnumerate" calls do not trigger Finder / fileproviderd to process each chunk of files so they are only taken in account at the very end of the enumeration cycles when finishEnumerating gets called. Some of my enumeration have several thousands items so it can take several minutes to enumerate and then an other several minutes after finishEnumerating is called to display in Finder ( as you found out ).

Question is how to trigger fileproviderd to take each chunk of items in account when calling observer.didEnumerate ?

Actually this does not happen only in Finder, but also in terminal if you list a path (ls path).

Slow NSFileProviderEnumerator
 
 
Q