Re: Fast NSArray compare
Re: Fast NSArray compare
- Subject: Re: Fast NSArray compare
- From: ChanMaxthon <email@hidden>
- Date: Wed, 16 Apr 2014 00:26:58 +0800
Another wild thought, how about drop one layer lower to POSIX and use a little bit of OpenCL? For every directory with content paths C[0..i] and the list of restricted paths R[0..j] construct a matrix (using OpenCL) M[0..i, 0..j] where M[i, j]=strcmp(C[i], R[j]) (strcmp() itself can be OpenCL code as well, using bit wise XOR and NOT) and logic AND every element in every row (another OpenCL operation). This will spit out an array of booleans indicating whether the path in question should be skipped.
Sent from my iPad
> On Apr 15, 2014, at 8:02 AM, Varun Chandramohan <email@hidden> wrote:
>
> Hi All,
>
> I have a question about efficiency when trying to compare NSURL. The requirement is quite simple. I try and iterate through a directory to all subdirectories and files. While doing this walk-through, I need to check against an array of NSURLs which are restricted files and folders.
> This means if I find a match of file I am trying to access in the array then I don't do any operations on that file and continue.
>
> Lets say I walkthrough 1000 files and folders, for each file/folder I need to compare against this array list. This might be slow or inefficient. Is there a faster way to do something like this?
>
> Secondly, I plan to store array of NSURL for restricted files and folders. What is the best way to get partial compare?
>
> Eg: Entry in array : /XYZ/abc
> This means I should not iterate into the abc folder. So any files /XYZ/abc/1.c or /XYZ/abc/def/2.c should all be skipped. Whats the best way to do partial NSURL compare? Or is it better I store it as NSString instead of NSURL?
>
> Regards,
> Varun
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden