Core Data Performance

  • I know that this subject has been covered many times and all the
    related posts are very useful. However, I was reading the
    documentation recently and I'm sure that I read somewhere that there
    is a way to query the Managed Object Context instead of executing a
    fetch request. But since then I have not been able to find it in the
    documentation again. Was I just imagining things or is there a way to
    do this? Will the performance difference be vastly different?

    Many thanks,

    Phil.
  • um, to execute a fetch request you do query the managed object
    context. Can you clarify what you mean a little more?

    Mike.

    On 19 Feb 2008, at 22:35, Philip Bridson wrote:

    > I know that this subject has been covered many times and all the
    > related posts are very useful. However, I was reading the
    > documentation recently and I'm sure that I read somewhere that there
    > is a way to query the Managed Object Context instead of executing a
    > fetch request. But since then I have not been able to find it in the
    > documentation again. Was I just imagining things or is there a way
    > to do this? Will the performance difference be vastly different?
    >
    > Many thanks,
    >
    > Phil.
  • Sure,

    The article I read said something like:

    "Executing a fetch request requires a round trip to the persistent
    store.... you can avoid the overhead of executing the fetch request
    by searching the managed object context..."

    Something like that, to be honest I can't find it any where in the
    documentation and I only posted because I started to think I might
    have been imagining things.

    Hope this helps.

    Phil

    On 19 Feb 2008, at 23:43, Mike Abdullah wrote:

    > um, to execute a fetch request you do query the managed object
    > context. Can you clarify what you mean a little more?
    >
    > Mike.
    >
    > On 19 Feb 2008, at 22:35, Philip Bridson wrote:
    >
    >> I know that this subject has been covered many times and all the
    >> related posts are very useful. However, I was reading the
    >> documentation recently and I'm sure that I read somewhere that
    >> there is a way to query the Managed Object Context instead of
    >> executing a fetch request. But since then I have not been able to
    >> find it in the documentation again. Was I just imagining things or
    >> is there a way to do this? Will the performance difference be
    >> vastly different?
    >>
    >> Many thanks,
    >>
    >> Phil.
    >
  • > "Executing a fetch request requires a round trip to the persistent
    > store.... you can avoid the overhead of executing the fetch request
    > by searching the managed object context..."
    >
    > Something like that, to be honest I can't find it any where in the
    > documentation and I only posted because I started to think I might
    > have been imagining things.

      I'm having trouble understanding what you're asking too, but ...
    are you perhaps referring to in-memory array filtering (with
    predicates)? See NSArray's -filteredArrayUsingPredicate:

      If you already have a fetched set of managed objects (assuming you
    understand all the implications regarding faulting), you can filter
    them in memory using this method.

    --
    I.S.