You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Becky Gibson (Commented) (JIRA)" <ji...@apache.org> on 2012/04/06 20:35:23 UTC

[jira] [Commented] (CB-402) Improve Contacts search taking a long time by using (NSArray*)filteredArrayUsingPredicate:(NSPredicate*)predicate

    [ https://issues.apache.org/jira/browse/CB-402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13248580#comment-13248580 ] 

Becky Gibson commented on CB-402:
---------------------------------

FYI - the code from Erica referenced above is using predicates to against an array of ABContact - a class that she has created from the ABPersonRecord data.  Predicates don't seem to work directly against an ABPersonRef.  That's not to say we couldn't rewrite the Contacts code to use Erica's approach of copying from an ABPersonRef into our own type of Person class.  At the time I thought that was overkill since we have to translate again to the W3C representation.  I won't argue that contacts code could be cleaner an more Object oriented.
                
> Improve Contacts search taking a long time by using (NSArray*)filteredArrayUsingPredicate:(NSPredicate*)predicate
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: CB-402
>                 URL: https://issues.apache.org/jira/browse/CB-402
>             Project: Apache Callback
>          Issue Type: Improvement
>          Components: iOS
>            Reporter: Shazron Abdullah
>            Assignee: Shazron Abdullah
>
> We have to analyze this first to see if it is a big problem, with a huge N. I believe it is.
> Right now our search method is O( n ), while using Apple's search method it is possibly O( log n ) - but that's just a guess if I assume internally they use a binary search.
> Steps:
> 1. Grab all the contacts in a NSArray through ABAddressBookCopyArrayOfAllPeople
> 2. Construct a NSPredicate for the filter, and call filteredArrayUsingPredicate on the NSArray returned in step 1.
> 3. Convert the NSArray returned in step 2. to our CDVContact objects

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira