Re: CoreData fetch is way too slow
Re: CoreData fetch is way too slow
- Subject: Re: CoreData fetch is way too slow
- From: James Hober <email@hidden>
- Date: Tue, 26 Feb 2008 11:22:25 -0800
A while back, James Hober wrote:
I simply changed the predicate from using LIKE to using == and fetch
time plummeted from 7 seconds to 0.18 seconds.
This is very usable. I think it is a better user experience to shave
off the 3.5 seconds of launch time that my previous implementation
needed in exchange for each query taking 0.18 seconds.
Several of you suggested indexing the attribute I search against. It
looks like indexing an attribute is only available in Leopard and for
now I have to support Tiger.
I will continue to investigate further optimization.
Turns out I really did want to index the Core Data attribute. Fetch
time without indexing was still a bit too long, and especially after
a restart could be more than 3 seconds. That's not the first
impression I want to make to a user.
But since I'm doing this on Tiger, I simply used Terminal to navigate
to the Xcode project folder, typed "sqlite3 MyDBfile.db" and then at
the sqlite prompt typed "CREATE INDEX ZMYENTITY_ZINPUT_INDEX ON
ZMYENTITY (ZINPUT);"
(apparently Core Data prefixes 'Z' to your identifiers.)
Now all the fetches seem to be a speedy 0.02 to 0.03 seconds.
Am I in any danger going around Core Data's back this way?
James
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden