Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Kieran Robinson
Kieran Robinson
9,411 Points

Speeding up Core Data Stored images

Hi guys, I am displaying images in UITableViewCells (one large image plus a button that shows 2 more images in a scroll view). The images are all stored in core data (stored as binary data, with both 'allows external storage' and 'store in external record file') as i followed the Core Data course with Ash Furrow to achieve this. However when the table grows to 100+ cells, the UI is very slow and unresponsive and also seems to load the images one by one (when i scroll, it freezes before every image is displayed). Any help regarding speeding up the process of loading images from core data is much appreciated, kieran

2 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

Core Data performance is nuanced and depends on many variables. You should watch this video on Core Data Performance Optimization. One quick fix is to set the fetchBatchSize property of your NSFetchRequest to a low number like 10 or 20. The other thing you might want do is store a thumbnail image so you are not loading big images in a table view cells. Hope that helps. I would highly recommend watching that video because it has really good insights.

Kieran Robinson
Kieran Robinson
9,411 Points

Thanks a lot Amit Bijlani, I will watch the video now and i've already implemented the batchSize to 10, which has sped up the app massively. Thanks again!