Code Monkey home page Code Monkey logo

Comments (9)

danielrhodes avatar danielrhodes commented on August 30, 2024

It's the [old isValid] call on line 232 of RHAddressBookSharedServices.m. If you remove that, it seems to account for most of the slowness.

from rhaddressbook.

heardrwt avatar heardrwt commented on August 30, 2024

I don't think some of the geo logic gets quite as much testing as other areas in general.

I'll see what i can do, however i'm out in the field atm, so currently have limited connectivity.

from rhaddressbook.

dvkch avatar dvkch commented on August 30, 2024

Okay nice. No problem this ain't an issue so it is not that urgent. Also I sometime get a lot a slowness when accessing properties through this lib compared to using apple C API with the recordRef property from your classes. It can sometimes multiply by a factor 10 or even more the total time of execution.

from rhaddressbook.

airdrummingfool avatar airdrummingfool commented on August 30, 2024

If I don't need address geolocation in my app, would it cause a problem if I just disabled the entire if(addresses) statement?

from rhaddressbook.

cliffrowley avatar cliffrowley commented on August 30, 2024

Even with geocoding disabled, RHAddressBook is still slower than direct access by a very long way. Looking at the profiler it seems that the thread safety is the root of the problem. Enumerating contacts using RHAddressBook adds a whole second or so delay. Unless I've missed something obvious, this is a major bummer.

from rhaddressbook.

heardrwt avatar heardrwt commented on August 30, 2024

Feel free to post the code you are using to do these comparisons. Depending on what exactly you are doing, there will likely be ways to optimise it, however i've never had a need to do so. I'm always open to pull requests.

from rhaddressbook.

pirtil avatar pirtil commented on August 30, 2024

I'm seeing same slowness but interestingly only when I set my iPhone5 device language to Finnish. When it's English, it works okay. When it's Finnish, my main thread blocks for minutes.

I added some debugging NSLog's, there you can see how slow it is:
2013-08-01 16:12:52.309 blindsquarebeta[283:907] -[RHAddressBookSharedServices loadCache]:192
2013-08-01 16:12:52.321 blindsquarebeta[283:c703] -[RHAddressBookSharedServices rebuildCache]:219
2013-08-01 16:12:56.930 blindsquarebeta[283:c703] ** isValid
2013-08-01 16:12:56.931 blindsquarebeta[283:c703] ** associatedAddressDictionary
2013-08-01 16:12:56.933 blindsquarebeta[283:c703] ** starting ABAddressBookCreateWithOptions
2013-08-01 16:13:29.891 blindsquarebeta[283:c703] ** ABAddressBookCreateWithOptions done
2013-08-01 16:13:37.191 blindsquarebeta[283:c703] ** associatedAddressDictionary done
2013-08-01 16:13:37.192 blindsquarebeta[283:c703] ** newHash call
2013-08-01 16:13:37.195 blindsquarebeta[283:c703] ** newHash = 6d4948fc85746e95752bc78986a52152
2013-08-01 16:13:38.578 blindsquarebeta[283:c703] ** isValid
2013-08-01 16:13:38.579 blindsquarebeta[283:c703] ** associatedAddressDictionary
2013-08-01 16:13:38.580 blindsquarebeta[283:c703] ** starting ABAddressBookCreateWithOptions
2013-08-01 16:14:11.224 blindsquarebeta[283:c703] ** ABAddressBookCreateWithOptions done

So, in RHAddressBookGeoResults.m, in -(NSDictionary*)associatedAddressDictionary,
just calling "addressBookRef = ABAddressBookCreateWithOptions(nil, &errorRef);"
takes 33 seconds!

I copy paste little more so you can see my NSLog's:
-(NSDictionary*)associatedAddressDictionary{

NSLog(@"** associatedAddressDictionary");
NSDictionary *result = nil;
ABAddressBookRef addressBookRef = NULL;

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000
if (ABAddressBookCreateWithOptions != NULL){

    CFErrorRef errorRef = NULL;

    NSLog(@"** starting ABAddressBookCreateWithOptions");
    addressBookRef = ABAddressBookCreateWithOptions(nil, &errorRef);
    NSLog(@"**  ABAddressBookCreateWithOptions done");

PS. I'm testing with latest iOS6 in device

from rhaddressbook.

heardrwt avatar heardrwt commented on August 30, 2024

Hmmm. Very strange re the language thing. I spent some time trying to reproduce on my iOS 6 device, however it behaved correctly.

Any chance you could chuck the code in question up in a gist?

from rhaddressbook.

pirtil avatar pirtil commented on August 30, 2024

Thank you for looking this. I just got it working -- I was initializing RHAddressBook from viewDidAppear. I added 0.1 second delay to initialization and it solved the problem. So, some timing related problem which was triggered by language setting...

from rhaddressbook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.