Kevin Wu
Kevin Wu

Reputation: 1477

NSKeyedArchiver Performance

I am currently investigating different storage methods for UIImages and came across NSKeyedArchiver. It is no mystery that reading and writing data using this tool is somewhat slow. However, I want to know why this is. Is it due to the fact that objects need to be encoded and decoded all the time?

What are the best alternatives here (perhaps Core Data?)? My requirements are that I need to store approximately 10-20 images at any given time and need read/write operations to be really fast.

Upvotes: 0

Views: 431

Answers (1)

Avi
Avi

Reputation: 7552

For images, the best general solution is to simply read and write image files in a standard format (png, jpg, etc.). I do not know which image format will encode or decode in the least time, but I suspect the real answer depends on the specific images. Trying to put them in a container will always impose unnecessary overhead.

There are some specialist solutions for images that involve writing files in a format that can be memory-mapped, without the need for additional processing. Take a look at FastImageCache, for example.

Upvotes: 0

Related Questions