1

I currently have a UITableViewController that parses a JSON response (using TouchJSON) fired asynchronously using an ASIHTTPRequest.

I'm very concerned with the performance of my application.. 6 out of 10 API calls on average would lead to request timeouts and the combined time to fire an API call and parse an API call for 20 objects (each with about 10 attributes) ..takes around 8-9 seconds.

What can I do to speed up/streamline this process? Any methods / libraries I should be looking at to strip down the time to 2 seconds or less?

dpigera
  • 3,339
  • 5
  • 39
  • 60
  • Did any answer help you? Just click the check mark to mark it as an accepted solution or vote it up. And please check your other questions for possible solutions, too. Thanks! :) (And yes, this is copy-pasted so new users are aware of the voting system.) – Henrik P. Hessel Sep 26 '10 at 03:11
  • It seems rather worrying that you're getting 40% of your API calls ending in a timeout - I presume you mean a HTTP timeout from ASIHTTPRequest? Do you know why that is happening? It seems a little premature to talk about speedup/optimisation if the requests are failing 40% of the time! – JosephH Sep 26 '10 at 04:24
  • Did you measure where the time is spent? If it's mainly spent on waiting for the response, then you need to optimize the server side. Can the requests be fire in parallel or must they be sent serially because the depend on the result of the previous one? Is it spent in the JSON parsing? Then you should incrementally parse the answer with every chunk of data you receive (I've built such a JSON parser). You'll get better answers if you provide more information. – Codo Sep 26 '10 at 09:42

1 Answers1

0

Are you firing the requests in parallel or serially? You can simplify sending lots of requests by using ASINetworkQueue, and you can report progress on the whole (which might make the 8-9 seconds feel better).

But the queue will likely take longer than firing all of the requests in parallel. You'll have to use the request.userInfo dictionary to provide some context for each request so that your requestDidFinish callback can distinguish between the responses.

I'm a big fan of ASIHTTPRequest though, I don't think you'll find anything much better.

Ben Scheirman
  • 40,531
  • 21
  • 102
  • 137
  • I'm using it for a single API request. So I have a single ASIHTTPRequest .. hence: request.delegate=self / [request startAsyncronous]... – dpigera Sep 26 '10 at 01:44