iphone - saving an image as data to coredata
I have a part of my app that has to save the current screenshot of the main screen at the time the user starts changing elements. Actually I have managed to fire a second thread to perform this screenshot save. The captured image is saved to disk.
All works perfectly but there's a 0.1 second lag between the user touching the screen and the screen responding, because even in a second thread, the file I/O is lagging the app.
I w开发者_StackOverflowas wondering if it would be fast if instead of saving the image to a file, saving it as data to a coredata object.
What do you guys think about it? Would it be faster?
thanks
I don't think core data would be faster than writing it directly to disk, as you even remove overhead by directly writing to the filesystem. The only improvement by CoreData would be its caching mechanisms. The writing to persistent memory could be delayed but not avoided.
Did you have a look at your app with instruments and analyze the bottleneck? Maybe file IO is not the real problem.
精彩评论