dotcoder
dotcoder

Reputation: 2921

Performance issue in downloading the images on iPhone from the server

We have an application on iPhone. This application displays 25 products per page/screen. The text items such as product name, price, discount, URL of the product image, etc of all the 25 products is downloaded from the server first.

After that we make 25 synchronous requests to download the 25 product images, one after the another. Each image is about 25KB in size and these are of size 300 by 400 pixels approximately and we only need 72 by 72 pixels size images for display on iPhone. We notice that it takes about 40 seconds to display one screen/page and this sort of performance is not good. So we are investigating how to increase the performance.

  1. Will the performance improve if we scale down the size of the images on the server to 72 by 72 pxiels.
  2. Also is it possible to download all 25 images from server to the iPhone? If so can you please share your approaches as to how to do that? We want to do this only if it can improve the performance.

Upvotes: 0

Views: 608

Answers (3)

Dinesh Patel
Dinesh Patel

Reputation: 142

**You can use sdwebimage framework for images download from server in ios ** **You can use this link **

go to this link

download frame and get information , how to use it.

Upvotes: 0

John Parker
John Parker

Reputation: 54415

First off, scaling the images on the server is a complete no-brainer - there's no need to download any more data that you absolutely have to.

Once you've done that you'll see a marked performance improvement, which you can further increase by using placeholder images and downloading the real images in the background asynchronously. (The ASIHTTPRequest library is a nice wrapper for such functionality.)

Finally, if appropriate you should use an image cache and store the images locally (perhaps with references in an SQLite database). However, you'll need to perform maintenance on this occasionally to keep it within a sensible filesize limit.

Upvotes: 0

Sorin Antohi
Sorin Antohi

Reputation: 6135

1.if you resize them to 72x72 then you will a have smaller size to download in total so it's faster.

2.for batching i don't have a solution but you could try to make an asynchronous request for each file. while downloading put a temporary image(a logo or something). when the image is downloaded replace the temp image with the new one. you can put the images in a cache in order not to download them every time.

for asynchronous download you can use ASIHTTPRequest(it also has a cache class).

if you do synchronous requests then your GUI will freeze until they are finished.

Upvotes: 2

Related Questions