Download is kinda slow?

Topics: User Forum
Sep 25, 2006 at 11:58 AM
Hey Guys,

I'm not sure if this is a flickr thing or flickrnet, but it seems to be incredibly slow downloading images with the flickr.download method. In an album with 70 images (grabbing each, just the thumbnail) the api calls take around 1 second, but fetching these 70 thumbnails is taking 50+ seconds. Surely thats a bit much? The connections a 10 megabit dedicated, so i doubt thats an issue.

Any ideas?

Thanks,

Dfects
Sep 25, 2006 at 1:35 PM
You could try downloading a set of images through a standard downloadmanager and compare both downloadtimes.
Coordinator
Sep 27, 2006 at 4:23 PM
Any chance you can benchmark this and let me know? I am curious and would like to improve the speed if I can.

Sam
Dec 9, 2006 at 12:37 AM
It is certainly slower then if you used libcurl or some other way.. I'll try to post some benchmarks soon.
Coordinator
Dec 15, 2006 at 4:40 PM
I've done some very quick tests and changing the buffer size doesn't change the speed of the download.

I'm thinking therefore thats it must be the writing of the Cache that is the slow part.

Can you try a) disabling the cache, and b) with cache enabled view the same thing twice (i.e. the second time it should load from cache).

Sam
Dec 16, 2006 at 10:24 AM
I just slotted in libcurl for downloading the thumbnails and it was noticably much faster.

i reckon the .net implementation is dropping the connection between calls, can see no other reason.
Dec 16, 2006 at 12:08 PM
snippet of code you can nail in to use curl instead of downloadpicture:


using SeasideResearch.LibCurlNet;

///-------- inside some function
Easy easy = new Easy();
Easy.WriteFunction wf = new Easy.WriteFunction(OnWriteData);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
easy.SetOpt(CURLoption.CURLOPTURL, tehphoto_url );
easy.SetOpt(CURLoption.CURLOPT_WRITEDATA, ms);
easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);
easy.Perform();
easy.Cleanup();
ms.Seek(0, System.IO.SeekOrigin.Begin);

// ms is now your stream, ready to go

//-----------------

// and you need a delegate function

public static Int32 OnWriteData(Byte[] buf, Int32 size, Int32 nmemb, Object extraData) {
System.IO.MemoryStream ms = extraData as System.IO.MemoryStream;
int byteSize = size * nmemb;
ms.Write(buf, 0, byteSize);
return byteSize;
}