iPhone Strange CoreData Caching Performance Issues -


i'm working on app uses core data , nsfetchedresultscontroller. major component of app filtering down items in indexed table view based on set of 15 or pre-defined switches correspond property or relationship of managed objects. in of situations, i'm searching through set of around 300-400 objects, caching/performance not issue. snappy no caching required.

however, there part of app searches through objects in cd database (~15,000 items). here, i'm trying implement caching on nsfetchedresultscontroller improve performance. 'cachestring' property nsfetchedresultscontroller predicate's string value. whenever user toggles filter switch, create new predicate, create new nsfetchedresultscontroller, , set cache new predicate's string value. first hit items (unfiltered) takes ~7 seconds, subsequent hits taking less one.

what's strange, though - , here's problem - once proceed 'next step' of table view (i push new view controller nav controller, passing reference nsfetchedresultscontroller's fetchedobjects), performance drops considerably. next view different representation (a horizontally paging scroll view) of previous view's table list 1 item on screen @ once. when page 1 item next, accessing previous or next object in fetchedobjects array locks phone 5 seconds. 'lock up' duration increases further go fetchedobjects array. if 'i == 0', there no perceivable lag. if 'i == 10,000', takes 15 seconds access next object. nuts! if disable caching (or it's query wasn't cached needed pull fresh results), except initial filter query fast , snappy 0 lag.

does enabling caching cache indexing info table view , not fetched objects themselves?

i'm not sure deal here. hope explained enough - let me know if want see code or need additional info.

thanks! billy

alright, i've found out problem was...

basically, asking nsfetchedresultscontroller managedobject via objectatindexpath: immensely faster going directly fetchedobjects array , asking objectatindex: (which, of course, doing), index gets thousands. i'm not sure 100% why is, though. i'm guessing nsfetchedresultscontroller fancy stuff efficiently pull out single objects rather going straight raw data. so, don't think caching had performance issue.

thanks checked out question. hope helps else having similar issues.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -