Does the performance of saving ManagedObjectContext keep the number of contained (immutable) objects?

General CoreData / SQLite Question

Is there a significant difference between the two scenarios when saving an NSManagedObjectContext using SQLite repository:

  • After adding / modifying / deleting one object in NSManagedObjectContext containing 10 , otherwise without changing NSManagedObjects
  • After adding / modifying / deleting a single object in NSManagedObjectContext containing 10,000 otherwise unchanged NSManagedObjects
+1
performance objective-c iphone core-data nsmanagedobject
source share
3 answers

Summarizing my experience with Enterprise Objects (from which the main data came from), I would say that both of your scripts will be equally fast without indexing, and the second one will be slightly slower with indexing.

Using and storing SQL, the cost of adding one object is largely fixed regardless of how many other objects are on the chart. Indexing does have a scaling effect because the index depends on other existing objects. However, in the vast majority of cases this does not matter.

The more complex the relationships inside the graph, the more it saves the effect of the overall size of the graph. Obviously, if you have a graph with only ten objects, then no relationship can contain more than ten objects. If you have 10,000, the relationship is potentially much larger and takes longer to process.

In general, Core Data with SQL repository seems to be largely independent of graph size.

+2
source share

Profiling will tell you if there is a significant difference. However, I suspect that the type of store coordinator will influence the actions. Updating an object in an SQLite database is probably faster and more scalable than in an XML tree.

+1
source share

In my previous experience there is no significant difference. If the added / modified / deleted object contains many indexed attributes, then this will be slightly larger compared to the case of an object without indexed attributes, but this is expected since the indexes will also be changed.

0
source share

All Articles