iPhone: fastest way to fire API calls and parse JSON?
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 timeout开发者_运维技巧s 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?
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.
精彩评论