>             //This takes about 6 seconds each search for song*
>            for (id key in songsDictionary) {
>                NSString *thisSong = key;
>                int suppliedCount = [stringValue length];
>                int keyCount = [thisSong length];
>                //Fuzzy matching
>                if(suppliedCount > keyCount){
>                    match= [StringDistance stringDistance:thisSong
> :stringValue];
>                } else {
>                    match= [StringDistance stringDistance:stringValue
> :thisSong];
>                }
>                //Get the very best match there is to be found for song.
>                if(match < currentFoundValue){
>                    currentFoundValue = match;
>                    test = [songsDictionary objectForKey:thisSong];
>                    dis = [NSArray arrayWithObject:test];
>                    collection = [[MPMediaItemCollection alloc]
> initWithItems:dis];
>                }
>            }

Did you ever Time Profile this?  While there are some minor inefficiencies (Why 
initialise 'dis' and 'collection' on every incremental result?  Why initialise 
suppliedCount every loop iteration?), it's likely that all your time is spent 
in your distance calculation.  While you probably assumed that, I'm having a 
hard time imagining what it could be doing that would justify it being so slow. 
 A Time Profile might show you something surprising.  And/or, you could post 
your distance algorithm for the list to look over.
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to