Thanks for the replies. However, my app is already built on top of Core Data so switching to another framework isn't really an option.
On 2011-07-14, at 2:58 PM, Ruslan Zasukhin wrote: > On 7/14/11 9:15 PM, "Indragie Karunaratne" <cocoa...@indragie.com> wrote: > > Hi Indragie, > > You may want to consider just to use other db engine. > > For example, our Valentina db engine can be 100+ times faster of normal RDB > engines... > > If you have interest I can give you more details. > >> Hi guys, >> >> I'm working on a search feature in one of my Core Data based apps and I'm >> trying to gather everyone's tips on search optimization to get it as fast as >> I >> possibly can. The search needs to be fast enough that it can deliver >> near-instantaneous results for database of 20,000+ objects. >> >> What I've done so far (as far as optimization goes) >> - Implemented the technique shown in WWDC 2010 session 137, creating a >> keyword >> entity and creating a to-many relationship from my main object entities to >> it. >> The keyword entity's 'name' attribute is indexed, and keywords are created >> during the initial import procedure by splitting apart relevant strings in >> the >> main entities and normalizing them (stripped of case and diacritics) >> - Using >= and < binary comparators instead of BEGINSWITH, etc. My predicate >> format is: SUBQUERY(keywords, $keyword, ($keyword.name >= $LB) AND >> ($keyword.name < $UB)).@count != 0 >> >> Where $LB is the lower bounds string and $UB is upper bounds. I create a >> compound AND predicate using this format and the array of search terms. >> >> Right now, I'm executing a fetch once (when the user types the first letter) >> using a fetch batch size of about 20, and then narrowing down the search >> results using NSArray's -filteredArrayUsingPredicate method as they continue >> typing. I also prefetch the "keywords" relationship because this is used to >> filter. The part that takes up the most time, obviously, is the initial >> fetch. >> There's a noticeable delay of ~1-2s on a library of around 15,000 objects. >> Time profiling shows that it is indeed the fetch that is causing the delay: >> >> http://cl.ly/3a1b2022452M2V323f2H >> >> One other thing thats worth noting is that I have to fetch multiple entities >> for the results. All of the entities have a "ranking" attribute, but I can't >> fetch more than one at once so I'm forced to fetch them separately, combine >> them into a single array, and then sort manually via >> -sortedArrayUsingDescriptors. >> >> Any tips on how to speed this up would be greatly >> appreciated._______________________________________________ >> >> 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/ruslan_zasukhin%40valentina-d >> b.com >> >> This email sent to ruslan_zasuk...@valentina-db.com >> > > -- > Best regards, > > Ruslan Zasukhin > VP Engineering and New Technology > Paradigma Software, Inc > > Valentina - Joining Worlds of Information > http://www.paradigmasoft.com > > [I feel the need: the need for speed] > > _______________________________________________ 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