Database Reference
In-Depth Information
For maximum performance, you need to strike a balance between the number of
objects you fetch at any given time and the usefulness of having many records
taking up valuable space in RAM.
The startup time of the app is a little slow, suggesting something is going on with
the initial fetch.
Fetch batch size
Core Data fetch requests include the fetchBatchSize property, which makes it easy
to fetch just enough data but not too much.
If you don't set a batch size, Core Data uses the default value of 0, which disables
batching.
Setting a non-zero positive batch size enables you to limit the amount of data
returned to the batch size. As the app needs more data, Core Data automatically
performs more batch operations.
If you were to search the source code of the Employee Directory app, you wouldn't
see any calls to fetchBatchSize . That indicates another potential area for
improvement!
Let's see if there are any places you could use a batch size to improve the app's
performance. I probably don't have to tell you there are!
Measuring the problem
You'll use the Instruments tool to analyze where fetching is occurring in your app.
First, select one of the iPhone simulator targets and then from Xcode's menu bar,
select Product and then Profile (or press I). This will build the app and launch
Instruments .
Note: You can only use the Instruments Core Data template with the
Simulator, as the template requires the DTrace tool which is not available on
real iOS devices.
A selection window like the following will greet you:
Search WWH ::




Custom Search