On 2009 Apr 20, at 11:24, Jim Correia wrote:

On Apr 20, 2009, at 2:02 PM, Jerry Krinock wrote:

Makes me wonder why NSFetchRequest even supports a predicate, since its predicate has all these limitations and is supposedly more expensive when compared to fetching all objects and then using - [NSArray filteredArrayWithPredicate:] ?

You are taking that quote out of context and misinterpreting it.

Yes, you're correct about that; I was being sloppy there.

However, I did my own experiment on this with about 1200 objects a few months ago, each object having about 2 dozen attributes and a couple of relationships. A couple hundred bytes in each record. I compared the time for a Core Data fetch-with-predicate versus Core Data fetch- without-predicate followed by array filtering. Apples versus apples. The latter was slightly faster.

For others this may not be true -- "Always test performance in your own app" -- and now I understand why NSFetchRequest supports a predicate. But in my case the search completes in milliseconds, and not having to program around the limitations of Core Data's fetch-with- predicate is a huge advantage.

On 2009 Apr 20, at 13:09, Sean McBride wrote:

It strikes me that if one currently develops with with XML store, and then one day switches to the SQL store ... when one is in for lots of things suddenly breaking.

Yup. I gleefully chucked that off my "list of things to retest" after I ditched the Core Data fetch-with-predicate.

On 2009 Apr 20, at 11:23, Melissa Turner wrote:

Doing filtering in memory is a code smell. It generally signals that you're fetching against the wrong entity, or that your model needs to be tweaked to be more efficient.

Well, when I first started with Core Data, my religion was: "Oooo -- database -- relationships -- Oooo -- queries -- fast -- cool". But it doesn't always pan out.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to