Code Monkey home page Code Monkey logo

Comments (10)

heardrwt avatar heardrwt commented on August 30, 2024

Do you have any particular thoughts on what exactly is slower?

There is obviously some overhead required to maintain the thread safety. We could likely switch over to using a dispatch queue instead of a thread at some point, now that ABAddressBook has clarified its thread safety model to include queues.

from rhaddressbook.

nickbit avatar nickbit commented on August 30, 2024

I've done some time profile tests. May I sent you them?
It is the same app running both solutions.

from rhaddressbook.

heardrwt avatar heardrwt commented on August 30, 2024

Sure. email is richard at my domain

from rhaddressbook.

nickbit avatar nickbit commented on August 30, 2024

Traces sent...

from rhaddressbook.

heardrwt avatar heardrwt commented on August 30, 2024

Sent over a .diff that replaces the AB internal Thread with a Queue.
http://pastebin.com/raw.php?i=5TiUMPYR

from rhaddressbook.

heardrwt avatar heardrwt commented on August 30, 2024

Nick, while simplifying the implementation of -(NSArray*)people; would be ideal, its not quite as simple as it appears on the surface. Most of the logic done in the people method is required to maintain thread safety. The good news is most of the performance hit is on the first access, so doing this on a background thread, async should be an easy solution for now.

I'll be keeping an eye out for ways to dig into it and perhaps improve it further, however i wont have much time in the next 2 or so weeks.

If you need, i can offer some tips on the best ways to avoid blocking the main thread.

from rhaddressbook.

nickbit avatar nickbit commented on August 30, 2024

Thank you Richard, I really appreciate your efforts. I want to use the code badly. It offers all the features I am seeking for.

As for the app, I am not blocking the main thread at the time, but since the app is Contacts based, the interface gets updated after processing the contacts.

What I realized while exploring your code is that the bottleneck (97%) is in the serial search for a matching RHPerson in the _people NSMutableSet, which is ever expanding.
A hash table lookup on another recordIDs cache could solve the problem.
Maybe a NSMutableDictionary linking recordIDs to RHPersons?
You know better of any implications.

Here is the offending code:

    //look in the cache
    for (RHPerson *entry in _people) {
        //compare using ID not ref
        if (personID == entry.recordID){
            person = arc_retain(entry);
            break;
        }
    }

from rhaddressbook.

heardrwt avatar heardrwt commented on August 30, 2024

Good catch. That can certainly be speed up. If i have some time tonight, i'll dig into it further. Thanks.

from rhaddressbook.

heardrwt avatar heardrwt commented on August 30, 2024

I just pushed a commit 642a851 that makes this stuff a bunch faster.
Thanks for the feedback.

from rhaddressbook.

nickbit avatar nickbit commented on August 30, 2024

Richard thank you very much.
You are amazing!
Nikos

Από το iPad μου

12 Νοε 2012, 4:27 π.μ., ο/η Richard Heard [email protected] έγραψε:

I just pushed a commit 642a851 that makes this stuff a bunch faster.
Thanks for the feedback.


Reply to this email directly or view it on GitHub.

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.