On 2 Aug 2009, at 06:50, Ben Lachman wrote:
I'm working on a small iPhone project this weekend that among other things downloads some medium sized video files. To do this I set up a NSURLConnection and use an NSOutputStream to write the data to my apps' documents folder as it arrives. The only problem is that I'm seeing lousy download speed, particularly over wifi (~200K/sec over 3G, <100K/sec over wifi). Any ideas as to why this might be or if there is anything I can do to improve things? Currently in connection:didReceiveData: I append the incoming data to a temporary buffer (mutable data obj) and then every ~1MB I write it out to disk using my output stream. I do this because writing the stream to disk every time I received data was even slower.
Well part of the problem here is likely to be that programming FLASH memory is just plain slow. I don't know how fast the FLASH is on the iPhone, but the kind of numbers you mention look suspiciously like the kinds of values I'd expect for write performance of that kind of memory.
To eliminate that as a cause of the problem, I'd try receiving the data but not saving it. If that fixes the problem, it seems to me you need to save asynchronously (e.g. on a separate thread).
I'd also be inclined to take a look at the TCP/IP connection using a network analyser; if something is causing TCP to enter congestion control, for instance, that can seriously degrade performance.
Kind regards, Alastair. -- http://alastairs-place.net _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com