I'm experiencing some performance problems loading about 60 images from a SQLite3 table with the following table:
select rowid, thumbnail
from my_table
where category_id = 4
I have an index on category_id, yet it takes about 2.5 seconds to load a table of 170 70x70 PNG images.
In my code, I create an NSMutableArray of objects representing each row, like this:
Item* item = [[Item alloc] init];
item.rowid = sqlite3_column_int( statement, 0 );
int thumbnailLength = sqlite3_column_bytes( statement, 1 );
NSData* data = [NSData dataWithBytes:sqlite3_column_blob( statement, 1 ) length:thumbnailLength];
item.thumbnail = [[UIImage imageWithData:data] autorelease];
[result addObject: item]
iPhoto can load an album with almost no visible loading time. Is there some SQLite3 trick that I'm missing that can boost performance here?