Performance issue with loading image from url

R

Raj Chudasama

i have a need to load image from URL. the image is really small (gif) and i
use the following code.

but the code is too slow any1 have any alternative way(S)?
here is the url
http://phone.avioninc.com/asterisk/wami/graphics/phoneringing.gif

-----------------------here is the performance counter out put when i use
the code .--------------------------------

creating extensions -----------------
creating extensions Done ------------------ 3.34650549161975
creating extensions -----------------
creating extensions Done ------------------ 0.192390932367103
creating extensions -----------------
creating extensions Done ------------------ 0.185763833112868
creating extensions -----------------
creating extensions Done ------------------ 0.186087058550738
creating extensions -----------------
creating extensions Done ------------------ 0.187169039640513
--------------------------here is the performance counter output when i DO
NOT use the code.--------------------------------
creating extensions -----------------
creating extensions Done ------------------ 0.0457695042246989
creating extensions -----------------
creating extensions Done ------------------ 0.0147314812357436
creating extensions -----------------
creating extensions Done ------------------ 0.0162037353909505
creating extensions -----------------
creating extensions Done ------------------ 0.0166747449745708
creating extensions -----------------
creating extensions Done ------------------ 0.0188892722399076
creating extensions -----------------
creating extensions Done ------------------ 0.0150602939759103
creating extensions -----------------
creating extensions Done ------------------ 0.0156684718309171
-------------------- CODE ------------------------
private void SetCallerId(string url)
{
try
{
if(url == null)
{
CallerPicture.Image = null;
return;
}

Stream s = MakeStream(url);
if(s != null)
{
Bitmap temp = new Bitmap(s);
Bitmap image = new Bitmap(temp);
temp.Dispose();
s.Close();
CallerPicture.Image = image;
}
else
CallerPicture.Image = null;
CallerPicture.Refresh();
}
catch
{
return;
}
}
 
J

Jon Skeet [C# MVP]

Raj Chudasama said:
i have a need to load image from URL. the image is really small (gif) and i
use the following code.

<snip>

Well, you haven't given the code for MakeStream, which could well be
significant...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top