URLByResolvingBookmarkData is extremely slow ... a solution?

I have a project application and you need to track several thousand resource files. Each file on the disk is represented by my "MyElement" object in my application. When I use the path to track the location of the file, the performance is very good ... a project file with links to 4000 files opens after about 1.5 seconds.

However, if I use bookmarks while I get a lot (files can move without breaking my link to them), the performance is terrible.

Opening the same project where I have to use URLByResolvingBookmarkData to get the file path takes about 25 seconds.

Application profiling shows that time is spent deep in URLByResolvingBookmarkData ... mainly in an OS function called volumePropertyProviderPrepareValues.

I switched to using bookmarks, but also cached the path. However, when I open the project, it takes a lot of time for each bookmark and make sure that my cache path is still relevant.

Is there a way to improve bookmark performance in this situation?

They were created using

NSData* bookmarkData = [fileURL bookmarkDataWithOptions:NSURLBookmarkCreationMinimalBookmark includingResourceValuesForKeys:nil relativeToURL:nil error:&inError]; 
+5
source share

Source: https://habr.com/ru/post/1209581/


All Articles