• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CoreData performance issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData performance issues


  • Subject: Re: CoreData performance issues
  • From: mmalcolm crawford <email@hidden>
  • Date: Tue, 21 Jun 2005 19:29:00 -0700


On Jun 21, 2005, at 7:07 PM, Tomek Piatek wrote:
This sounds "unusual". How are you determining uniqueness?

With the Project entity we just search for any projects with the matching name:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name = % @", projectName];
[fetchRequest setPredicate:predicate];
...
NSArray* results = [managedObjectContext executeFetchRequest:fetchRequest error:&error];
[...]
Running Shark over the application shows that 90% of the time the code is in the executeFetchRequest.



Ah, I did wonder... Since you're bringing everything into memory anyway, could you simply maintain an array of each of the entities and do an in-memory filter?
- (NSArray *)filteredArrayUsingPredicate:(NSPredicate *)predicate


<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ ObjC_classic/Classes/NSArray.html#//apple_ref/doc/uid/20000137-BAJJDBEB>

If the returned array is empty, then you have a new instance etc...


We had a look at the sqlite database created by CoreData and the only indexing appears to be done on the relationships. There is no indexing done on attributes. Is there any way to force indexing on particular attributes?

Oh, hooray, thank you for asking!  :-)

Yes. This is not "official" (i.e. it's undocumented) at the moment, but I'm allowed to say, modulo usual caveats...

You can create indexes in the SQLite stores for attributes (other than those Core Data automatically creates for you) by adding an entry in the userInfo dictionary for an attribute with the key "_NSCreateIndex"...

For most applications there should typically be no need to do this. It's only likely to be of help if your data set size is in or close to six figures. But you seem to qualify. :-)

mmalc

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: CoreData performance issues (From: Tomek Piatek <email@hidden>)

  • Prev by Date: Re: CoreData performance issues
  • Next by Date: Re: Confused by Apple's DragNDropOutlineView example
  • Previous by thread: Re: CoreData performance issues
  • Next by thread: Re: Cocoa-dev Digest, Vol 2, Issue 951
  • Index(es):
    • Date
    • Thread