[
https://issues.apache.org/jira/browse/CB-402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13635730#comment-13635730
]
Benjamin Hill commented on CB-402:
----------------------------------
2.6.0 on an iPhone 4S running 6.1.3
search for all, return "displayName", "name", "emails"
2013-04-18 14:38:01.084 ArchiveContacts[1482:907] [LOG] #DEBUG About to search
for all contacts...
2013-04-18 14:38:12.514 ArchiveContacts[1482:907] [LOG] #DEBUG Found
contacts:2800
... so ~11 seconds to find 2800 contacts.
Changing the search to ["*"] increases the time to return all contacts to
2013-04-18 14:40:24.148 ArchiveContacts[1497:907] [LOG] #DEBUG About to search
for all contacts...
2013-04-18 14:42:01.482 ArchiveContacts[1497:907] [LOG] #DEBUG Found
contacts:2800
~ 2 minutes.
Both 11 seconds to get the basic info and 2 minutes to get the full info seems
really long, even for 3k worth of contacts. The native AB is instant.
> 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 Cordova
> Issue Type: Improvement
> Components: iOS
> Reporter: Shazron Abdullah
> Priority: Minor
> Labels: benchmark, unit-test
> Fix For: 2.7.0
>
>
> 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
For more information on JIRA, see: http://www.atlassian.com/software/jira